Javascript 对checkcolumn的checkchange事件进行单元格编辑
我一直在sencha论坛以及堆栈溢出上寻找解决方案。我无法找到这个问题的适当解决办法。我想编辑网格中某行的某个特定单元格,在该行的某个check列发生checkchange事件时进行编辑 下面是代码-Javascript 对checkcolumn的checkchange事件进行单元格编辑,javascript,extjs,extjs4,Javascript,Extjs,Extjs4,我一直在sencha论坛以及堆栈溢出上寻找解决方案。我无法找到这个问题的适当解决办法。我想编辑网格中某行的某个特定单元格,在该行的某个check列发生checkchange事件时进行编辑 下面是代码- var unitStore = Ext.create('Ext.data.Store', { fields: ['phone'], autoLoad:true ,
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":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "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()
});
用于在调用startEdit函数之前延迟。在这篇文章中修改了您的示例:有一个关于如何设置问题格式的教程。请参考。这对你有很大帮助。谢谢你的建议。我是个新手。在发布任何进一步的信息之前,将继续检查该信息。:)我在ExtJS中使用网格单元格编辑。我想通过手动调用startEdit方法而不是通过单击来编辑单元格。如何通过单击禁用编辑器的可编辑性。我有一个只允许编辑特定列的检查列。我修改了celleditor插件的beforeedit侦听器。它成功了。