DoJo Enhanced grid updating constraints dynamically is not working

◇◆丶佛笑我妖孽 提交于 2019-12-13 03:45:28

问题


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:


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



来源:https://stackoverflow.com/questions/53717280/dojo-enhanced-grid-updating-constraints-dynamically-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!