Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 以编程方式更改EditorGrid';s细胞值_Javascript_User Interface_Extjs - Fatal编程技术网

Javascript 以编程方式更改EditorGrid';s细胞值

Javascript 以编程方式更改EditorGrid';s细胞值,javascript,user-interface,extjs,Javascript,User Interface,Extjs,我有一个编辑器网格,如果某个特定单元格处于焦点(正在编辑),将弹出一个包含树面板的窗口,允许用户从树面板中选择一个节点作为单元格的新值。这样,用户实际上并不是在编辑相关单元格,而是在使用窗口选择新值。但是,我很难通过编程方式设置相关单元格的值 下面是我用来设置网格的代码,包括根据值类型选择单元格编辑器的列模型: var editorCM = new Ext.grid.ColumnModel({ //config ,editors : { //rest of editors

我有一个编辑器网格,如果某个特定单元格处于焦点(正在编辑),将弹出一个包含树面板的窗口,允许用户从树面板中选择一个节点作为单元格的新值。这样,用户实际上并不是在编辑相关单元格,而是在使用窗口选择新值。但是,我很难通过编程方式设置相关单元格的值

下面是我用来设置网格的代码,包括根据值类型选择单元格编辑器的列模型:

var editorCM = new Ext.grid.ColumnModel({
  //config
  ,editors : {
    //rest of editors
    'id' : new Ext.grid.GridEditor(new Ext.form.TextField({readOnly : true}))
  }
  ,getCellEditor : function(col, row) {
    //choose editor depending on the type value of a cell
  }
})

var editorGrid = new Ext.grid.EditorGridPanel({
  //rest of config
  ,cm : editorCM
})
下面是我的代码,在用户从树面板中选择后更改单元格的值

function submitNode(newValue) {
  var temp = editorGrid.GetSelectionModel().getSelectedCell(); //returns array containing column and row position of selected cell, which value we want to change.

  //temp[1] = column index, temp[0] = row index
  //Gets the cell editor at specific position and sets new value for that cell
  editorGrid.getColumnModel().getCellEditor(temp[1], temp[0]).setValue(newValue);
}

我还尝试了其他几种方法(都包括setValue(newValue)),但都是空手而归。我已经浏览了API和ExtJS论坛,寻找任何线索,但也空手而归。

我没有使用编辑器网格,所以我将它挂在那里一点

请参阅以下内容:

他们(添加)的方式似乎是直接更新存储,如果您能够识别存储记录,您肯定可以直接更新它

查看addPlant的处理程序:

 handler : function(){
            // access the Record constructor through the grid's store
            var Plant = grid.getStore().recordType;
            var p = new Plant({
                common: 'New Plant 1',
                light: 'Mostly Shade',
                price: 0,
                availDate: (new Date()).clearTime(),
                indoor: false
            });
            grid.stopEditing();
            store.insert(0, p);
            grid.startEditing(0, 0);
        }
如果做不到这一点,我很想看看当你让你的领域不再是只读的时候会发生什么:

  ,editors : {
//rest of editors
'id' : new Ext.grid.GridEditor(new Ext.form.TextField({readOnly : false}))  }

只是一些想法

我没有使用编辑器网格,所以我将它挂在那里一点

请参阅以下内容:

他们(添加)的方式似乎是直接更新存储,如果您能够识别存储记录,您肯定可以直接更新它

查看addPlant的处理程序:

 handler : function(){
            // access the Record constructor through the grid's store
            var Plant = grid.getStore().recordType;
            var p = new Plant({
                common: 'New Plant 1',
                light: 'Mostly Shade',
                price: 0,
                availDate: (new Date()).clearTime(),
                indoor: false
            });
            grid.stopEditing();
            store.insert(0, p);
            grid.startEditing(0, 0);
        }
如果做不到这一点,我很想看看当你让你的领域不再是只读的时候会发生什么:

  ,editors : {
//rest of editors
'id' : new Ext.grid.GridEditor(new Ext.form.TextField({readOnly : false}))  }
只是一些想法