ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: angelahlp on February 20, 2014, 08:54:15 am
-
I am creating an array that I am using to populate drop down boxes inside the grid. I would like to use this same array to populate the drop down box for a column filter but cannot figure out how to format the array so that it is accepted by the "options" in the filter under colModel. Code examples are below. Any help is appreciated!!!
var arrSimulatorGroups = [];
$.ajax({ url: "/cfc/form.cfc?method=getSims&randomval=" + noCache, success: function (response) { arrSims = response.split(","); } });
colModel: [...
{ title: "Sim", width: 150, dataIndx: 'sim', render: filterRender,
editor: {
type: function (ui)
{dropDownEditor(ui,arrSims)}
},
filter: { type: 'select',
options: arrSims, <----------------------------this is where the array is not being accepted-------------------
condition: 'equal',
listeners: [{ change: function (evt, ui) {
filter("sim, $(this).val());
}
}]
}
},
-
var arrSimulatorGroups = []; //<- it should be arrSims??
$.ajax({ url: "/cfc/form.cfc?method=getSims&randomval=" + noCache, success: function (response) { arrSims = response.split(","); } });
You make an async Ajax call and arrSims is available after it has been already been assigned (empty value) to the filter. You should assign the arrSims to filter within the success callback
success: function (response)
{
arrSims = response.split(",");
var column = $grid.pqGrid("getColumn", {dataIndx: 'sim'});
column.filter.options = arrSims;
$grid.pqGrid("refresh");
}