在Ext.grid.Panel单元格中解析脏标志 [英] Resolving Dirty Flag in Ext.grid.Panel cell
问题描述
JavaScript代码:
},{
header:'Save',
xtype:'actioncolumn',
align:'center',
width:50,
sortable:false,
items:[ {
图标:'./Scripts/extjs/examples/shared/icons/fam/add.gif',
工具提示:'Save Row',
处理程序:function(grid,rowIndex, colIndex){
store.sync();
alert('saving');
}
}]
},{
header:'Delete',
xtype:'actioncolumn',
align:'center',
width:50,
sortable:false,
items:[{
icon:'./Scripts/extjs/examples/shared/icons/fam/delete.gif',
tooltip:'Delete Task',
处理程序:function(grid,rowIndex,colIndex){
store.removeAt(rowIndex);
store.sync();
提醒('删除');
}]
}
网格反映了底层商店的状态,它是基于您的数据模型的记录集合。所以作为一个快捷方式,你可以这样做:
//保存处理程序
处理程序:函数(网格,rowIndex,colIndex){
store.sync(); //现在不起作用
store.getAt(rowIndex).commit(); //提交更改,清除脏标志
alert('Record should be clear');
}
In an Ext JS grid, I'm editing individual cells. In one of the columns I have a Save button which fires the Save event. How can I remove the dirty flag (in red box in my image below) in the edited cell? I don't know how to perform the create, update and destroy options with the proxy because the documentation have a good example, so I'm planning on doing an AJAX request for these steps until I can take actual Sencha training. However, if the dirty flag resolves itself if I work the store and proxy directly, I'd prefer to do it the right way.
JavaScript Code:
}, {
header: 'Save',
xtype: 'actioncolumn',
align: 'center',
width: 50,
sortable: false,
items: [{
icon: './Scripts/extjs/examples/shared/icons/fam/add.gif',
tooltip: 'Save Row',
handler: function (grid, rowIndex, colIndex) {
store.sync();
alert('saving');
}
}]
}, {
header: 'Delete',
xtype: 'actioncolumn',
align: 'center',
width: 50,
sortable: false,
items: [{
icon: './Scripts/extjs/examples/shared/icons/fam/delete.gif',
tooltip: 'Delete Task',
handler: function (grid, rowIndex, colIndex) {
store.removeAt(rowIndex);
store.sync();
alert('deleting');
}
}]
}
A Grid reflects the state of underlying Store, which is a collection of records based on your data Model. So as a shortcut before you have your Ajax proxy figured out, you can do this:
// Save handler
handler: function(grid, rowIndex, colIndex) {
store.sync(); // Doesn't work now
store.getAt(rowIndex).commit(); // Commit changes, clearing dirty flag
alert('Record should now be clear');
}
这篇关于在Ext.grid.Panel单元格中解析脏标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!