1
我有一个编辑器网格面板,有2个字段。基于第一个字段,第二个字段应该更改为具有其他选项的组合框。为此,需要运行第一个字段的值来激发第二个字段的查询。 该代码工作正常并重新获取数据。但即使第二个字段的宽度为350,出现的组合框也非常小,无法读取。即使下拉没有看到。我也尝试了ListWidth属性..但没有改变输出。Extjs combobox不显示数据
是因为,最初组合框是空的,我使用beforequery属性来更改带有id字段的url,所以组合框没有获取数据?但我在萤火虫上看不到任何错误。
我有以下代码:
createGrid= function(e){
var store= new Ext.data.Store({
autoLoad: true,
proxy: new Ext.data.HttpProxy({ url: ..... }) //url to get the data
reader: new Ext.data.JsonReader({
root: //the root,
id: //id,
sortInfo: {field: 'id', direction: 'ascending' },
fields: ['id','fields']
})
});
var store2= new Ext.data.store ({
autoLoad: true,
id: 'store2',
proxy: new Ext.data.HttpProxy({ url: ' '}) //url
reader: new Ect.data.JsonReader({
root: 'enums','id', fields: ['enum_id','value']
})
});
var cm=new ext.grid.columnModel([
{id:'id',name:'id',dataIndex: 'id', width: 300},
{id:'fields', header: 'fields',width: 350, editor: new Ext.form.ComboBox({
name: 'combo',
store: store2,
width: 350,
valueField: 'enum_id',
displayField: 'value',
listeners: {
beforequery: function(query){
var g_n=Ext.getCmp('grid1');
var s_t=g_n.getSelectionModel().getSelections();
var record=s_t[0];
var assign_data=record.get('id');
var actionStore=Ext.StoreMgr.get('store2');
var action_combobox=Ext.getCmp('combo1');
actionStore.proxy.conn.url=' ',//new url which requires the 'id' field
actionStore.load();
return query;
}
}
})},
]);
return new Ext.grid.EditorGridPanel({
id: 'grid1',
store: store,
cm:cm,
sm: new Ext.grid.RowSelectionModel ({ singleSelect: true});
autoExpandableColumn: 'fields',
listeners: {
//the other grid listeners
}
})
}
请帮我解决这个问题。 在此先感谢。
什么是您正在使用ExtJS的的版本替换
Ext.data.store
?另外,这里的'combo1'代表哪个字段用于你的听众'beforequery'中?作为一个随机检查,我希望您的商店字段和来自服务器的JSON密钥存在匹配。 – netemp我正在使用extjs-3.3.1。而且,一旦用户点击“字段”单元格,网格面板中的字段“字段”就会被替换为组合框。在萤火虫中,我可以看到值得到检索。在萤火虫中没有显示错误。唯一的事情是,组合框的宽度非常小,下拉也没有显示出来。 – user977933
组合框的名称是'combo1'..对于代码部分的拼写错误。 – user977933