简体   繁体   English

ExtJS 4使用Ext.grid.plugin.RowEditing根据另一个值更改单元格值

[英]ExtJS 4 change cell value based on another with Ext.grid.plugin.RowEditing

I have TreeGrid with multiple columns and I use RowEditing plugin to save data. 我有多个列的TreeGrid,并且使用RowEditing插件保存数据。 I want to change value of "Total" dynamically when "Price" changes. 我想在“价格”更改时动态更改“总计”的值。 I made the following, but it doesnt work. 我做了以下工作,但是没有用。 when I look at "Total" object, I see thet value is changed, but a cant see this in RowEditing plugin at the time of editing and before update. 当我查看“总计”对象时,我看到值已更改,但是在编辑时和更新前在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'
    }
}

I found the solution! 我找到了解决方案!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM