ExtJS 4通过Ext.grid.plugin.RowEditing来改变单元格值



我有多列的TreeGrid,我使用RowEditing插件来保存数据。当"价格"发生变化时,我想动态地改变"Total"的值。我做了下面的,但它不起作用。当我看到"Total"对象时,我看到值被改变了,但是在编辑时和更新之前,在RowEditing插件中看不到这一点。

{
    text: 'price',        
    dataIndex: 'price',
    editor: {
    xtype: 'textfield',
            listeners: {
                change: function (field, newValue, oldValue, eOpts) {
                    var selectedModel = MyTree.getSelectionModel().getSelection()[0];
                    selectedModel.set('total', 'Total sum is' + field.value);
                }
            }
    }
}, 
{ 
    text: 'total',        
    dataIndex: 'total',
    editor: {
        xtype: 'textfield'
    }
}

我找到解决方案了!

var total = MyTree.getPlugin('roweditor').editor.down('textfield[name=total]');
total.setValue('Total sum is' + field.value);`

最新更新