jqGrid过滤工具栏初始默认值 [英] jqGrid Filter Toolbar initial default value

查看:30
本文介绍了jqGrid过滤工具栏初始默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有过滤器工具栏的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆