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

六月ゝ 毕业季﹏ 提交于 2019-12-23 05:40:41

问题


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.

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

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:


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:



来源:https://stackoverflow.com/questions/26965094/the-selected-value-was-cleared-in-dropdown-after-add-new-criteria-in-jqgrid-adva

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!