Slickgrid:是否可以将选项传递给编辑器

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

本文关键字:编辑器 选项 是否 Slickgrid      更新时间:2023-09-26

例如:LongTextEditor具有固定的宽度和高度:

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

参数化它会很好,比如这样:

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

是的,您可以按如下方式实现。

将选项列表传递到列阵列

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

然后您可以在编辑器中访问它(编辑器的默认文件Slick.editors.js

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