Search code examples
javascriptslickgrid

Slickgrid: Is it possible to pass options to an editor?


For example: LongTextEditor has fixed width and height:

$input = $("<TEXTAREA hidefocus rows=5 style='backround:white;width:250px;height:80px;border:0;outline:0'>")
      .appendTo($wrapper);

It would be nice to have it parameterized, something like this:

$input = $("<TEXTAREA hidefocus rows=5 style='backround:white;width:"+options.width+";height:"+options.height+";border:0;outline:0'>")
      .appendTo($wrapper);

Solution

  • Yes you can achieve it as follows.

    Pass options list to columns array

    var columns = [
            { id: "Id", name: "NAME", field: "FIELD", options: YourList, editor: Slick.Editors.YourEditor,},
                  ];
    

    Then you can access it in your editor(Default file for editors Slick.editors.js)

     function YourEditor(args) {
         //Access columns list using "args.column.options"
     }