the selected value was cleared in dropdown after add new criteria in jqgrid advanced searching

243 views Asked by At

In jqgrid advanced searching, the value selected in drop down list was cleared after i add new criteria.

Below detail for your reference.

1) in jqgrid column model

{name:'instrumentType', 
 index:'instrumentType',
 searchoptions:{
                dataInit:instrumentTypeDataInit,
                sopt: ['eq','ne','nu','nn','in','ni']},    
 align:"left", 
 stype:'select'},

2) javascripts function for instrumentTypeDataInit

instrumentTypeDataInit=function(el){
    var categoryInstrumentTypeOptions = "${categoryInstrumentTypeOptions}";  
    $(el).append(categoryInstrumentTypeOptions);
  }

3) when add criteria "Instrument Type", and select "OPTION", it goes well.

enter image description here

4) when add another criteria, the value selected is cleared.

enter image description here

Does anyone know why it is? and what's the solution? thanks a lot.

EDIT:

i've used the dataInit function in the wrong way, used searchOptions.value instead, the issue has been resolved, you can refer another post:best way to dynamically populate dropdown options in jqgrid advanced searching

1

There are 1 answers

0
Guanguan On BEST ANSWER

i've used the dataInit function in the wrong way, used searchOptions.value instead, the issue has been resolved, you can refer another post, Oleg has given an answer: