Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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
Extjs 在编辑时高亮显示网格行_Extjs_Extjs3 - Fatal编程技术网

Extjs 在编辑时高亮显示网格行

Extjs 在编辑时高亮显示网格行,extjs,extjs3,Extjs,Extjs3,我使用的是ExtJs3.2。 有一个gridpanel,其中一列有一个文本字段作为编辑器。 更改文本字段中的值时-我需要突出显示相应的行。 如何获取文本字段的“拥有”行索引 columns: [ ........... {header: 'Revenues',dataIndex: 'percentage', editor: new Ext.form.TextField({ listener

我使用的是ExtJs3.2。
有一个gridpanel,其中一列有一个文本字段作为编辑器。
更改文本字段中的值时-我需要突出显示相应的行。
如何获取文本字段的“拥有”行索引

 columns: [
      ...........
            {header: 'Revenues',dataIndex: 'percentage',
              editor: new Ext.form.TextField({
                     listeners: {
                        'change' : function (field, newValue, oldValue) {
                          if(oldValue!=newValue){
                         .......
                        //How do I get the row index?  
                         Ext.fly(grid.getView().getRow(row)).addClass('yellow-row');
                        }
                    }
            }

有没有其他方法可以做到这一点?

请尝试下面的方法

var grid = Ext.grid.GridPanel({
    store: yourStore,
    id: 'myGrid',
    colModel: new Ext.grid.ColumnModel({
        defaults: {
            width: 120,
            sortable: true
        },
        columns: [
            {id: 'Company', header: 'Company', width: 120, sortable: true, dataIndex: 'company'},
            {header: 'Change', dataIndex: 'change'},
            {
                header: 'Revenue',
                dataIndex: 'percentage',
                editor: new Ext.form.TextField({
                    listeners: {
                        'change': function(field, newValue, oldValue) {
                            if (oldValue != newValue) {
                                var sel = Ext.getCmp('myGrid').getSelectionModel().getSelected();
                                // if you select more than one record use getSelections instead of getSelected
                                console.log(sel);
                            }
                        }
                    }
                })
            }
        ]
    }),
    sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
    width: 500,
    height: 300,
    frame: true,
    title: 'My Grid'
});

这是行不通的,因为如果用户在填写字段后选择了另一行,那么所选行会发生变化。我不明白。如果您选择了行索引,为什么不设置背景色?如果我在第1行填写字段Revenue;然后用鼠标单击第2行-getSelected()将返回第2行而不是第1行,而不是按enter键或tab键。然后,尝试通过
rowdeselect
事件捕获取消选择的行。gridpanel上是否有这样的事件?我似乎找不到如何在该行上定义侦听器的示例。我使用的是ExtJs3.2