I have a datagrid table with rows data json look like this:
{
"rows":[
{"fruit":"Apple","color_option":"red,purple,blue"},
{"fruit":"Banana","color_option":"purple,yellow,red"}
],
"total":"2"
}
And the columns option for my table look like this:
var color_obj=[];
.
.
.
// datagrid options..
...
onClickCell:onClickCell, // i copied the row editing code from the Demo page.
onEndEdit:onEndEdit,
columns:[[
{field:'fruit',title:'Fruit'},
{field:'color_option',title:'Color',
formatter:function(v){
color_obj=[];
colors=v.split(",")
// i try to convert the color_option string as object
// to make it readable as combobox data
$.each(colors,function(i,j){
color_obj.push({val:j,txt:j})
})
return 'Choose the right color...';
},
editor:{
type:'combobox',
options:{
data:color_obj,
valueField:'val',
textField:'txt',
required:true
}
}
}
]]
When i run it, combobox are works but the option list is blank. I'm sure my combobox codes still not complete, i wish to make a combobox with options from the color_option string that are different on each rows. Please help.
Thank you.