listeners:{
load: function(sto, records){
sto.each(function(record){
if(record.data.value !=""){
var arr_value=record.data.value.split(","); if(arr_value.length>1){
record.data.editor= new Ext.grid.GridEditor(new Ext.form.ComboBox({
store: new Ext.data.ArrayStore({
fields: ['name'],
data: [arr_value] }),
typeAhead: true,
displayField: 'name',
selectOnFocus: true,
triggerAction: 'all',
mode: 'local'
}));
}
}
});
}
}
record.data.value的值是aaa,bb;但生成的下拉框选项中只有aaa,如果fields: ['code','name']那么下拉选框中只有bb,求解~~~
extjs 下拉框Ext JS
load: function(sto, records){
sto.each(function(record){
if(record.data.value !=""){
var arr_value=record.data.value.split(","); if(arr_value.length>1){
record.data.editor= new Ext.grid.GridEditor(new Ext.form.ComboBox({
store: new Ext.data.ArrayStore({
fields: ['name'],
data: [arr_value] }),
typeAhead: true,
displayField: 'name',
selectOnFocus: true,
triggerAction: 'all',
mode: 'local'
}));
}
}
});
}
}
record.data.value的值是aaa,bb;但生成的下拉框选项中只有aaa,如果fields: ['code','name']那么下拉选框中只有bb,求解~~~
extjs 下拉框Ext JS
store: new Ext.data.ArrayStore({
fields: ['name'],
data: [['aaa'],['bb']]
}),
typeAhead: true,
displayField: 'name',
selectOnFocus: true,
triggerAction: 'all',
mode: 'local'
})
['aaa','bb']这是一维数组
ext期望的是二维数组
[['aaa'],['bb']]
load: function(sto, records){
sto.each(function(record){
if(record.data.value !=""){
var arr_value=record.data.value.split(",");
var json_value=new Array();
for(var i=0;i<arr_value.length;i++){
json_value[i]=new Array();
json_value[i][0] = arr_value[i];
} if(arr_value.length>1){
record.data.editor= new Ext.grid.GridEditor(new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({
fields: ['name'],
data: json_value
}),
typeAhead: true,
displayField: 'name',
selectOnFocus: true,
triggerAction: 'all',
mode: 'local'
}));
}
}
});
}
}
这样写,创建一个二维数组就正确了~~ 谢谢提示~~\(^o^)/~