jqGrid筛选器工具栏的初始默认值 [英] jqGrid Filter Toolbar initial default value
问题描述
我正在使用带有过滤器工具栏的jqGrid,我需要将初始默认过滤器值设置为其中一个字段,以便默认情况下仅显示状态为打开"的行,但是如果需要,用户可以显示已关闭的行
I'm using jqGrid with the filter toolbar, i need to set an initial default filter value to one of the fields so that only rows with status 'Open' are displayed by default, but the user can display Closed rows if desired.
目前,我有这样的解决方法
At the moment i have a workaround like this
setTimeout(function() {$('#gs_Status').val('Open');$("#eventsGrid")[0].triggerToolbar()},500);
但是它导致了第二个请求,而且确实很糟糕.
but it results in a second request and is pretty bad really.
有人知道该怎么做吗?
编辑:更多研究表明,这可能是不可能的:(
Edit: A bit more research tells me this is probably impossible :(
推荐答案
您是否看过工具栏搜索和附加网格jqGrid文档Wiki中的方法?看来您可以使用filterToolbar
设置过滤器,并使用triggerToolbar
设置过滤器.我自己还没有尝试过,但是一旦为网格加载了数据,您就可以在loadComplete
中进行此操作.
Have you looked at Toolbar Searching and Add-On Grid Methods in the jqGrid documentation wiki? It looks like you may be able to use filterToolbar
to set a filter, and triggerToolbar
to set the filter. I have not tried this myself, but you could probably do this in loadComplete
, once data has been loaded for the grid.
有帮助吗?
这篇关于jqGrid筛选器工具栏的初始默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!