Elena
Elena

Reputation: 3

reload searchoptions in jqgrid with setColProp

I am using jqgrid and the toolbar filter. After filtering I want to reload the searchoptions in the toolbar filter with:

loadComplete: function() {
mygrid.jqGrid('setColProp','device_nr',{searchoptions: {dataUrl:'filter_jq.php?val=newval'}});
 }

I tried also:

 var str = ":All;1:Dev1;2:Dev2";
 mygrid.jqGrid('setColProp','device_nr',{searchoptions:{value:str}})

But nothing changed.(but I can change the param "sopt"). Is it possible to change the searchoptions in filter toolbar with setColProp?

This is how it defined in ColModel:

colModel:[{name:'device_nr',index:'device_nr', width:100, stype: 'select',searchoptions:{dataUrl:'filter_jq.php?val=init',sopt:['eq']}}
]

Upvotes: 0

Views: 2762

Answers (1)

Oleg
Oleg

Reputation: 221997

I am afraid that you will have to manually modify the contain of the corresponding select element of the toolbar. If the name of the corresponding column in the colModel is 'device_nr' the id of the corresponding control will be 'gs_device_nr' and you should do the following:

$("#gs_device_nr").html('<option value="">All</option>'+
                        '<option value="1">Dev1</option>'+
                        '<option value="2">Dev1</option>');

Upvotes: 3

Related Questions