I try to generate a string for the editoptions
value using a function.
The string should look like this: '1:Active;2:Inactive;3:Pending;4:Suspended'
.
If I try this string as the value the select on the grid works properly but when I generate it with the function exactly the same and it doesn't work. Can you please tell me what is wrong?
jqGrid code:
{
label:'Status',
name:'status',
editable:true,
edittype: "select",
stype:'select',
formatter:'select',
editoptions: { value: generate}
}
And the function
function generate(){
var s="";
$.ajax({
type:"GET",
url:"rst/crud/selectStatus",
dataType: "json",
contentType: "application/json",
success: function (data) {
response = $.parseJSON(JSON.stringify(data));
$.each(response, function(i, item) {
s+=response[i].id+":"+response[i].status+";";
});
s = s.substring(0, s.length-1);
// alert(s);
}
});
return s;
}