DoJo Enhanced grid updating constraints dynamicall

2019-08-26 07:21发布

I have a DoJo enhanced data grid with editable number text box with some default min & max constraints. I need to change the constraints once grid loaded completely. Please advise on same. below is the code snippet, where i have applied default constraint as min 0 and max 100.

  1. Is it possible to set min and max constraints values from the dataStore fields i.e minAge and maxAge while defining the layout?
  2. If not is it possible to update those default constraints?

    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条回答
老娘就宠你
2楼-- · 2019-08-26 07:45

You will need to update your layout with the grid.set('structure', layoutVariable) method.

查看更多
登录 后发表回答