ExtJS的。设置划线单元格值 [英] ExtJs. Set rowediting cell value
问题描述
编辑器有2列:一个带有组合框,另一个带有禁用的文本框。
更改组合框值后,我需要更改文本框值。 strong>
我有组合框监听器:
listeners = {
select:function(combo,records){
var editorRecord = myGrid.getPlugin('rowEditPlugin')。editor.getRecord();
editorRecord.data [SomeCol] =SomeValue;
}
}
但是,在另一个调用之前,文本框中的值不会刷新的roweditor。
我只需要将文本值设置为单元格,而不更新存储。而且如果我点击roweditor的取消按钮,我需要单元格值返回到旧的。
感谢你的时间,所有的回复和所有的帮助。 b $ b
您可以使用网格的选择模型进行更改,如下所示:
{
text:'Type',
dataIndex:'type',
editor:{
xtype:'combo',
typeAhead:true,
selectOnTab:true,
displayField:name,
listeners:{
select:function(combo,records){
myGrid = this.up( '网格');
var selectedModel = this.up('grid')。getSelectionModel()。getSelection()[0];
//selectedModel.set('dataIndexOfNextCol',Success);
val = combo.getValue();
if(val =='type1'){
Ext.getCmp('textFld')。setValue(success);
}
else {
Ext.getCmp('textFld')。setValue(failure);
}
}
},
{
text:'Item',
dataIndex:'item',
editor:{
xtype:'textfield',
id:'textFld'
}
}
您必须提交更新更新。因此,您可以调用编辑
事件监听器,
listeners:{
edit:function(editor,e){
e.record.commit();
}
},
为了参考,看看这个 DEMO
I have grid with RowEditing plugin. Editor has 2 columns: one with combobox and another with disabled textfield.
I need to change textfield value after changing the combobox value.
I have combobox listener:
listeners = {
select: function (combo, records) {
var editorRecord = myGrid.getPlugin('rowEditPlugin').editor.getRecord();
editorRecord.data["SomeCol"] = "SomeValue";
}
}
But value in the textfield does not refresh until another calling of roweditor.
I need just to set text value to the cell, without updating store. And also if I click cancel button of roweditor, I need cell value returning to old one.
Thanks for your time, all replies and all help.
You can change it using the selection model of the grid,something like this :
{
text: 'Type',
dataIndex: 'type',
editor: {
xtype: 'combo',
typeAhead: true,
selectOnTab: true,
displayField:"name",
listeners: {
select: function(combo, records) {
myGrid= this.up('grid');
var selectedModel = this.up('grid').getSelectionModel().getSelection()[0];
//selectedModel.set('dataIndexOfNextCol', "Success");
val = combo.getValue();
if(val == 'type1'){
Ext.getCmp('textFld').setValue("success");
}
else{
Ext.getCmp('textFld').setValue("failure");
}
}
},
{
text: 'Item',
dataIndex: 'item',
editor: {
xtype: 'textfield',
id: 'textFld'
}
}
You have to commit the changes on update.So you can call edit
event listener,
listeners: {
edit: function(editor, e) {
e.record.commit();
}
},
For reference , have a look at this DEMO
这篇关于ExtJS的。设置划线单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!