DoJo增强型网格动态更新约束不起作用

时间:2018-12-11 04:12:54

标签: dojo dojox.grid.datagrid dojox.grid dojo.gridx

我有一个DoJo增强型数据网格,带有可编辑的数字文本框,并带有一些默认的最小和最大约束。网格完全加载后,我需要更改约束。请在同一意见。以下是代码段,其中我将默认约束应用为最小值0和最大值100。

  1. 是否可以在定义布局时从dataStore字段设置最小约束值和最大约束值,即minAge和maxAge?
  2. 是否可以更新这些默认约束?

    require(["dojox/grid/cells/dijit","dojox/grid/DataGrid"],function() {   
           window.masterlayout = [ [
            {'name' : 'Employee Name',styles:"word-wrap:break-word;", 'field' : 'msisdn',editable : false},
            {'name' : 'Min Age','field' : 'minAge' ,styles:"word-wrap:break-word;",editable : false},
            {'name' : 'Max age','field' : 'maxAge' ,styles:"word-wrap:break-word;",editable : false},
            {'name' : 'Age',
             'field' : 'age',
             'editable': true, 
              singleClickEdit :true,
             'alwaysEditing': false,
              styles:"word-wrap:break-word;",
              autoSave : false, 
              type:dojox.grid.cells._Widget, 
              widgetClass: dijit.form.NumberTextBox ,
              widgetProps: {required: true }, 
              constraint:{min:0,max:100,places:0} ,
              formatter : function(item, rowIndex, cell) { 
                  var html = '<a href="javascript:ageLimitStatusGrid.edit.setEditCell(ageLimitStatusGrid.getCell(3),'+rowIndex+');">'+item+'</a>';
              return html; 
             }
           }
            ] ];
    });
    
                var url = "Test URL";
                dataStore =new ServerSideStore({target:url});
                ageLimitStatusGrid = new EnhancedGrid({
                        store: dataStore,
                        structure: masterlayout,
                        selectionMode : 'none',
                        autoHeight : true,
                        //autoWidth : true,
                        autoRender : true,
                        queryOptions : {'deep' : true},
                        noDataMessage : '<span class="dojoxGridNoData">No Data found</span>',
                        loadingMessage : '<fmt_rt:message key="clls.loading.message"/>',
                        rowsPerPage: 5,
                        baseClass: 'balance_list',
                        plugins: {
                            pagination: { 
                                pageSizes: [],maxPageStep: 5,
                                description: true,
                                sizeSwitch: true,
                                position: "bottom"
                            }
                        }
                }, "ageLimitStatusGrid");
                ageLimitStatusGrid.startup();
    

1 个答案:

答案 0 :(得分:0)

您将需要使用grid.set('structure',layoutVariable)方法更新布局。