the selected value was cleared in dropdown after a

2019-06-11 17:11发布

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条回答
戒情不戒烟
2楼-- · 2019-06-11 17:50

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:

查看更多
登录 后发表回答