2011-05-25 34 views
1

我正在寻找方法如何在按钮点击重置EditorGridPanel各个领域中的一列复位EditorGridPanel列的值

有柱的代码

.... 
{ 
    id: 'field_id', 
    header: "Amount [ton/ha]", 
    sortable: true, 
    dataIndex: 'amountId', 
    width: 150, 
    summaryType: 'sum', 
    summaryRenderer: function(v){ 
     return v +' [ton/ha]'; 
    },     
    editor: new Ext.form.NumberField({ 
     allowBlank: false, 
     allowNegative: false, 
     style: 'text-align:left' 
    }), 
    groupName: 'Amount' 
}, 
..... 

到目前为止,这将是可编辑,你可以从代码中看到什么,它的工作原理是完美的,只是想增加重置所有值的可能性,完全可以吗?

回答

3

Store甚至Record都有拒绝和提交更改的方法。我没有使用过他们,但我相信它会是这样:

Ext.getCmp('myGrid').getStore().getAt(0).rejectChanges(); 

,并在商店中的所有行:

Ext.getCmp('myGrid').getStore().rejectChanges(); 
+0

没错,就是它!感谢 – vaske 2011-05-25 10:51:17