【问题标题】:How to add filter in EnhancedGrid如何在增强网格中添加过滤器
【发布时间】:2015-08-03 13:01:19
【问题描述】:

我想在 dojox.grid.EnhancedGrid 中添加过滤器,并且我的网格是以声明方式创建的。我在 data-dojo-props 属性中添加了过滤器。

我的代码:

<div id="myGrid" 
    data-dojo-type="dojox.grid.EnhancedGrid" 
    data-dojo-props="plugins:{indirectSelection: true,nestedSorting: true,
                     filter: {
                         closeFilterbarButton: true,
                        ruleCount: 5,
                        itemsName: "songs"
                      } },
            store: mystore,
            structure: [{
                    defaultCell: { width: 8, editable: false, type: dojox.grid.cells._Widget, styles: 'text-align: left;'  },
                    rows: [
                        { field: 'RN', name: '${RN}', width: '32%',formatter : function(val, rowIdx, cell){
                              cell.customClasses.push('anchorLookAlike');
                              return val;
                            } 
                        },
                        { field: 'DC', name: '${DC}', width: '10%' },
                        { field: 'PN', name: '${PN}', width: '10%' },
                        { field: 'MD', name: '${MD}', width: '10%' },
                        { field: 'RD', name: '${RD}', width: '10%' },
                        { field: 'UR', name: '${UR}', width: '10%' },
                        { field: 'DL', name: '${DL}', width: '10%',formatter: function(datum){
                                if(datum){
                                    return dojo.date.locale.format(new Date(datum), {selector: 'date', formatLength: 'long'});
                                }
                                return '...';
                            } 
                        },
                        {field: 'RP', name: '', hidden: true}
                    ]
                }]"></div>

当我尝试运行此代码时遇到此错误,

dojo/parser::parse() error
Error: SyntaxError: syntax error in data-dojo-props='plugins:{indirectSelection: true,nestedSorting: true, filter: { closeFilterbarButton: true, ruleCount: 5, itemsName:

如何正确添加过滤器?有什么可以帮助我的

【问题讨论】:

    标签: javascript dojo dojox.grid dojo.gridx


    【解决方案1】:

    您需要将songs 括在单引号中,而不是双引号中。作为data-dojo-props 的一部分,您已经嵌套在双引号中。

    【讨论】:

    • 感谢杰夫法语。我纠正了我的错误,它工作正常。
    猜你喜欢
    • 1970-01-01
    • 2017-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-26
    • 1970-01-01
    • 1970-01-01
    • 2021-03-14
    相关资源
    最近更新 更多