我一直在为sencha论坛以及堆栈溢出寻找解决方案。我无法得到这个问题的适当解决方案。我想在该行的检查列的checkchange事件中编辑网格中某行的特定单元格。在checkcheumn的checkchange事件上进行单元格编辑
以下是代码 -
var unitStore = Ext.create('Ext.data.Store', {
fields: ['phone'],
autoLoad:true ,
proxy: {
type: 'memory',
}
});
var abc=Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"[email protected]", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
var cellEditing=Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
plugins: [cellEditing],
store: abc,
columns: [
{xtype:'checkcolumn' ,id:'check',dataIndex:'check', text:'Select' ,listeners:{
checkchange:function(checkbox, rowIndex, checked, eOpts){
if(checked==true){
//var abc=checkbox.up('grid').getStore().getAt(rowIndex).get('name');
var x=[{'phone':'2'},{'phone':'3'}];
unitStore.loadData(x);
//cellEditing.startEditByPosition({row: rowIndex, column: 3});
// this.up('grid').getSelectionModel().setCurrentPosition({row: rowIndex, column: 3});
cellEditing.startEdit(rowIndex,3);
}
}
}},
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone',editor:{xtype:'combo',store:unitStore,
queryMode:'local',displayField: 'phone',
valueField: 'phone',selectOnFocus:true,triggerAction: 'all',
} },
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
有一个格式化SO上的问题的教程。请参考。它可以帮助你很多。 – 2014-09-01 07:45:26
感谢您的建议。对于我来说,我很新。在发布任何进一步信息之前,请继续阅读。 :) – 2014-09-01 07:52:20