0

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

Community
  • 1
  • 1
Guanguan
  • 47
  • 2
  • 9
  • could you provide the demo which demonstrates the problem? It could be jsfiddle demo or any other, but it should use `jquery.jqGrid.src.js` instead of `jquery.jqGrid.min.js`. The code of `instrumentTypeDataInit` seems strange for me. What is `${categoryInstrumentTypeOptions}`? Is it an ` – Oleg Nov 17 '14 at 08:09
  • @Oleg, I just want to dynamically append the options to the select control. ${categoryInstrumentTypeOptions} is string of options, that populated from the server, and then set in request from server. so in ftl page, I use ${} to get the options. – Guanguan Nov 17 '14 at 10:15
  • @Oleg, I checked with another post you replied to me, maybe I use dataInt in the wrong way. will review you post carefully. thanks a lot. – Guanguan Nov 17 '14 at 10:23

1 Answers1

0

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:

Community
  • 1
  • 1
Guanguan
  • 47
  • 2
  • 9