AnyColumn 选项添加为 Dojo 增强网格视图中的新列

AnyColumn option added as new column in Dojo enhanced grid view

我正在研究 dojo 增强网格视图。我能够在 UI 中显示网格。但是 AnyColumn 选项被添加为新列。

示例:


任何帮助将不胜感激...

这是代码

var mygrid = new EnhancedGrid({
    id: "grid",
    store: gridStore, //Data store passed as input
    structure: gridStructure, //Column structure passed as input
    autoHeight: true,
    autoWidth: true,
    initialWidth: width,
    canSort : true,
    plugins: {
        filter: {
          //Filter operation
          isServerSide: true,
          disabledConditions : {"anycolumn" : ["equal","less","lessEqual","larger","largerEqual","contains","startsWith","endsWith","equalTo","notContains","notEqualTo","notStartsWith","notEndsWith"]},
          setupFilterQuery: function(commands, request){
              if(commands.filter && commands.enable){
                  //filter operation
                }
              }
            }
}, dojo.byId("mydatagrid"));   


mygrid.startup();

谢谢, 丽珊特

首先,不要使用 EnhancedGrid,而是使用 dgrid 或 gridx。

我认为默认情况下任何列都会添加到下拉列表中。如果你想删除,我建议

  1. 在过滤器定义上注册点击事件
  2. 遍历下拉列表并删除第一个条目,即 anyColumn

或者你也可以试试

dojo.forEach(this.yourgrid.pluginMgr.getPlugin('filter').filterDefDialog._cboxes, function(dropdownbox) {

dropdownbox._colSelect.removeOption(dropdownbox.options[0]);
});

更新后的答案是。我知道这不是一种优雅的方式,但它确实有效。

//reason why I'm showing the dialog is that _cboxes of the filter are empty initially.
    dijit.byId('grid').plugin('filter').filterDefDialog.showDialog();
dojo.forEach(dijit.byId('grid').pluginMgr.getPlugin('filter').filterDefDialog._cboxes, function(dropdownbox) {

          var theSelect = dropdownbox._colSelect;
          theSelect.removeOption(theSelect.options[0]);
          });

//Closing the dialog after removing Any Column
          dijit.byId('grid').plugin('filter').filterDefDialog.closeDialog();