我需要获得(检索)的控制器更新单元格的值。 (MVC)
所以,我想这一点,
var modified = this.getItemGrid().getStore().getUpdatedRecords();
console.log(modified); // return [] empty array
var modified = this.getItemList_Store().getUpdatedRecords();
console.log(modified); // return [] empty array
但它总是返回连我更新了一些单元格值空数组。
任何人都知道我做错了什么?
这是我的看法代码的一部分,
Ext.define("App.view.orders.ItemList_view", {
extend: "Ext.grid.Panel",
alias: "widget.itemList_view",
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
initComponent: function () {
this.store = "ItemList_store";
this.columns = [
{
xtype: 'checkcolumn', text: "Ship", width: 50, dataIndex: "DR"
},
{ header: "test", width: 100, dataIndex: "test",
editor: {
xtype : 'textfield'
}
}
];
this.selModel = Ext.create("Ext.selection.CheckboxModel");
//this.selModel = Ext.create("Ext.selection.CellModel"); // It does not works either.
this.callParent(arguments);
},
.
.
.
谢谢!
[编辑]
非常感谢您的回答! 我对编辑网格一些问题。
它包括ext3太大的不同。 所以我现在非常困惑:(
Q1。 如何收集编辑的记录数据(一次点击按钮)?
触发一次网格单元的情况下进行更改。 但我想收集编辑网格记录,一旦我点击“更新编辑的单元格”按钮,我想在一次一起更新。
在Ext3的,我不喜欢这样,
(button) click : function(){
var modified = mygridStore.getModifiedRecords();
var recordsToSend = [];
Ext.each(modified, function(record){
recordsToSend.push(record.data);
});
var grid = Ext.getCmp('grid');
grid.el.mask('Updating','x-mask-loading');
grid.stopEditing();
recordsToSend = Ext.encode(recordsToSend);
Ext.Ajax.request({
url : '/test/test',
params : {
data : recordsToSend
},
success : function(response){
grid.el.unmask();
alert(response.responseText);
mygridStore.commitChanges();
},
failure : function(response){
mygridStore.rejectChanges();
}
});
}
我怎样才能改变Extjs4的代码?
Q2。 我不知道怎么还是要找出改变checkcolumn。
我想这一点,但我不会为checkcolumn工作(事业我变化选择框后测试)
// grid coumn
{
xtype: 'checkcolumn', header: "My Check Column", width: 50, dataIndex: "CH"
}
-
// in control
'myGrid': {
validateedit: function (plugin, edit) {
console.log(edit);
},
checkchange: function (plugin, edit) {
console.log(edit);
console.log(edit.value);
}
}
Q3。 当我点击单元格以编辑,显示一些HTML标签的-_- ;;
我真的很感谢你的帮助。 并且非常感谢您的宝贵时间!