【问题标题】:DoJo Enhanced grid updating constraints dynamically is not workingDoJo 增强的网格动态更新约束不起作用
【发布时间】:2018-12-11 04:12:53
【问题描述】:

我有一个带有可编辑数字文本框的 DoJo 增强数据网格,带有一些默认的最小和最大约束。一旦网格完全加载,我需要更改约束。请提供相同的建议。下面是代码 sn-p,我将默认约束应用为 min 0 和 max 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();
    

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-02
      • 2013-08-01
      • 2013-01-27
      • 1970-01-01
      • 2018-06-17
      • 2011-08-14
      相关资源
      最近更新 更多