ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: bsolteam on August 09, 2014, 12:15:01 pm
-
Hi paramquery team,
I have a colmodel which is having the select tag. I want load the options for the select tag by making ajax call and get the data. I am getting the data in response, but that response data i have to display like option for select tag.So can u please give some suggestion for my problem.
Here is my code.
var colM = [ {
title : "Event",
width : '25%',
align : "center",
dataIndx : "eventType",
editable : false,
editor : {
type : 'select',
cls: "eventlist",
options : function(ui)
{
var opts = [];
var options = ui.column.editor.options;
cellData = ui.cellData;
$.ajax ({
type : 'GET',
url : "getEventType",
success : function(response) {
alert(response);
var cjson = eval('(' + response
+ ')');
for (var i = 0; i < cjson.length; ++i) {
opts.push(cjson.eventDesc);
}
for (var i = 0; i < cjson.length; i++) {
var option = opts;
if (option[cellData]) {
return option[cellData];
}
}
},
error : function(e) {
alert(e);
},
});
alert(opts);
},
},
}]
-
If the options in your select list are static then you could load them in create event of the grid and assign them to column.editor.options
If the options vary and you want to load them at every time of creation of select list, then you should make a synchronous ajax call by adding the below property in your $.ajax method
async: false