DoJo增强网格可编辑数字文本框约束

时间:2018-12-10 17:13:35

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

在定义网格布局时,我需要使用minCreditLimit和maxCreditLimit字段(而不是0和100)来设置creditLimit约束min和max。

如何将来自服务器的数据用作字段creditLimit的最小和最大约束?

代码段:

While definign grid layout i need to set the creditLimit constraints min and max with the fields minCreditLimit and maxCreditLimit instead of 0 and 100. 
Basically i need to use the data coming from server as min & max constraints for field creditLimit. Please suggesst.

require(["dojox/grid/cells/dijit","dojox/grid/DataGrid"],function() {	
	        window.masterlayout = [ [
         	    { 
         	        'name' : 'Mobile Number',styles:"word-wrap:break-word;", 'field' : 'msisdn',editable : false
         	    },
         	    {
           	        'name' : 'Min. Credit Limit','field' : 'minCreditLimit' ,styles:"word-wrap:break-word;",editable : false
           	    },
           	    {
             	   'name' : 'Max. Credit Limit','field' : 'maxCreditLimit' ,styles:"word-wrap:break-word;",editable : false
             	},
         	    {
         	     'name' : 'Credit Limit',
         	     'field' : 'creditLimit','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:creditLimitStatusGrid.edit.setEditCell(creditLimitStatusGrid.getCell(3),'+rowIndex+');">'+item+'</a>';
         	      return html; 
         	     }
         	   }
				] ];
    	});
		
					var url = "Test URL";
					dataStore =new ServerSideStore({target:url});
					creditLimitStatusGrid = 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"
				        		}
							}
					}, "creditLimitStatusGrid");
					creditLimitStatusGrid.startup();
					

0 个答案:

没有答案