用setColProp在jqgrid中重新加载searchopt

用setColProp在jqgrid中重新加载searchopt

本文介绍了使用setColProp在jqgrid中重新加载searchoptions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqgrid和工具栏过滤器.过滤后,我想使用以下命令重新加载工具栏过滤器中的searchoptions:

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'}});
 }

我也尝试过:

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

但是没有任何变化.(但是我可以更改参数"sopt").是否可以使用setColProp更改过滤器工具栏中的搜索选项?

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

这是在ColModel中定义的方式:

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']}}
]

推荐答案

恐怕您将不得不手动修改工具栏相应select元素的包含.如果colModel中相应列的名称是'device_nr',则相应控件的ID将是'gs_device_nr',您应该执行以下操作:

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>');

这篇关于使用setColProp在jqgrid中重新加载searchoptions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 09:32