chamlie
4 Feb 2008, 3:02 PM
Hi All,
I want to edit a field value in a grid and the changed grid value will load the datastore from the server side.
However, I have faced a problem that when I using Ext.getCmp to get the element out,
it is undefined.
colModel = new Ext.grid.ColumnModel([ //instantiate ColumnModel
{
align: 'left',
dataIndex: 'BlockID',
id : 'BlockID',
header:'Block ID',
sortable: true,
width: 20 ,
editor: new Ext.form.TextField({
allowBlank: false,
listeners:{change:function(){
var parent=Ext.getCmp('combobox-productid');
//I cannot get the 'combobox-productid' compoment
alert(parent);
var store =new Ext.data.Store({
baseParams:{ BlockID: this.value,
task: 'getProductList'
},
proxy:new Ext.data.HttpProxy({
url: 'getresult.php',
method:'POST'
}),
reader:new Ext.data.JsonReader({
id:'ProductID',
fields:['ProductID']
}),
remote:true
});
parent.store=store;
parent.displayField='ProductID';
parent.valueField ='ProductID';
}},
triggerAction:'all',
typeAhead :true,
anchor:'100%'
}) //close editor
},{
align: 'right',
dataIndex: 'ProductID',
header: "Product ID",
width: 20,
id:'combobox-productid',
defaults:{xtype:'combo'},
.....
})//,
I think it may due to the Ext.getCmp('combobox-productid') inside a textfield which cannot get the 'combobox-productid', but How can I solve it?
Thank you
I want to edit a field value in a grid and the changed grid value will load the datastore from the server side.
However, I have faced a problem that when I using Ext.getCmp to get the element out,
it is undefined.
colModel = new Ext.grid.ColumnModel([ //instantiate ColumnModel
{
align: 'left',
dataIndex: 'BlockID',
id : 'BlockID',
header:'Block ID',
sortable: true,
width: 20 ,
editor: new Ext.form.TextField({
allowBlank: false,
listeners:{change:function(){
var parent=Ext.getCmp('combobox-productid');
//I cannot get the 'combobox-productid' compoment
alert(parent);
var store =new Ext.data.Store({
baseParams:{ BlockID: this.value,
task: 'getProductList'
},
proxy:new Ext.data.HttpProxy({
url: 'getresult.php',
method:'POST'
}),
reader:new Ext.data.JsonReader({
id:'ProductID',
fields:['ProductID']
}),
remote:true
});
parent.store=store;
parent.displayField='ProductID';
parent.valueField ='ProductID';
}},
triggerAction:'all',
typeAhead :true,
anchor:'100%'
}) //close editor
},{
align: 'right',
dataIndex: 'ProductID',
header: "Product ID",
width: 20,
id:'combobox-productid',
defaults:{xtype:'combo'},
.....
})//,
I think it may due to the Ext.getCmp('combobox-productid') inside a textfield which cannot get the 'combobox-productid', but How can I solve it?
Thank you