当我单击 Ext.grid.Panel 中的列时,我需要修改文本字段中的值,因此我使用了 beforeshow 监听器,例如
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":"homer@simpsons.com", "phone":"555-222-1244"},
{"name":"Marge", "email":"marge@simpsons.com", "phone":"555-222-1254"}
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
rootProperty: 'items'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{header: 'Name', dataIndex: 'name', editor: 'textfield'},
{header: 'Email', dataIndex: 'email', flex:1,
editor: {
xtype: 'textfield',
allowBlank: false,
listeners : {
beforeshow : function(obj, event, eOpts) {
alert();
}
}
}
},
{header: 'Phone', dataIndex: 'phone'}
],
selModel: 'cellmodel',
plugins: {
ptype: 'cellediting',
clicksToEdit: 1
},
height: 200,
width: 400,
renderTo: Ext.getBody()
});
https://fiddle.sencha.com/#fiddle/qiv
但是当我单击该列时,监听器没有触发,您能否告诉我如何在单击该列时在文本字段中显示该值之前修改该值。
提前致谢。
最佳答案
如果你想显示与存储的值不同的值,我认为更好的方法是使用 Renderer在您的专栏中。
关于javascript - 在 Ext.grid.Panel 列中显示之前修改文本字段中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31452224/