我有一个带有可编辑数字文本框的 DoJo 增强数据网格,带有一些默认的最小和最大约束。一旦网格完全加载,我需要更改约束。请提供相同的建议。下面是代码片段,我将默认约束应用为 min 0 和 max 100。
- 是否可以在定义布局时从 dataStore 字段(即 minAge 和 maxAge)设置最小和最大约束值?
如果没有,是否可以更新这些默认约束?
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();