通过jqGridImport恢复JQGrid时搜索信息不正确

发布于 2024-10-26 08:31:44 字数 866 浏览 1 评论 0原文

使用 jqGridExport 导出数据后,我们使用 jqGridImport 导入。第一个问题是底部栏选项没有回来,所以我在之后添加了该代码。所以代码看起来像:

$("#list").jqGridImport({imptype: 'jsonstring', impstring: gridSettings})
.jqGrid('navGrid','#pager', { 编辑: false, 添加: false, 删除: false, 搜索: true, 刷新:true },
{},{},{},{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true},{});

gridSettings 字符串的关键部分是:
<代码> "postData":{"_search":true,
“nd”:1301031279941,
“行”:20,
“页”:1,
"sidx":"a.ID",
"sord":"asc",
"filters":{"groupOp":"AND","rules": [{"field":"fname","op":"bw","data":"T"}]}
}

除了搜索之外,一切都很顺利。上面 postData 中的一行搜索是正确的,但还有第二个搜索行,我只能将其描述为默认搜索行。如果我进去并从多个搜索框中删除该行,一切都会正常。

所以我的问题是首先,为什么当我使用 jqGridImport 恢复时 multipleSearch 没有恢复?
其次有没有办法以编程方式删除第二个搜索行?

After having exported data using jqGridExport we import using jqGridImport. First problem was that the bottom bar options did not come back so I added that code after. So code looks like:


$("#list").jqGridImport({imptype: 'jsonstring', impstring: gridSettings})
.jqGrid('navGrid','#pager', { edit: false, add: false, del: false, search: true, refresh:true },
{},{},{},{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true},{});

The critical part of the gridSettings string is:

"postData":{"_search":true,
"nd":1301031279941,
"rows":20,
"page":1,
"sidx":"a.ID",
"sord":"asc",
"filters":{"groupOp":"AND","rules": [{"field":"fname","op":"bw","data":"T"}]}
}

Everything comes up fine except for the search. The one line of search from postData above is correct but there is a second search line, which I can only describe as the default search line. If I go in and remove that line from the multiple search box everything is as it should be.

So my question is first, why does multipleSearch not come back up when I restore using jqGridImport?
Second is there a way to programmatically remove the second search line?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等往事风中吹 2024-11-02 08:31:44

带有导航器的底部栏的行为是正确的,因为它不是作为网格的一部分实现的。所以你真的必须另外设置它。您可以编写自己的设置导出和导入。

在搜索对话框中添加最后一行的情况确实是一个小问题,可以通过以下代码修复:

var grid = $("#list");
...

grid.searchGrid(prmSearch);
if (typeof(grid[0].p.postData.filters) === "string" &&
    grid[0].p.postData.filters.length>0) {

    $("#fbox_"+grid[0].id).searchFilter().del();
}
$("#fbox_"+grid[0].id).searchFilter().close();

您可以查看相应的演示 此处。这是对我的另一个演示的一个小修改="https://stackoverflow.com/questions/5283070/in-jqgrid-why-dont-toolbarfilter-and-multiple-search-filter-get-along-when-usin/5284375#5284375">旧答案。

顺便说一下,下一版本的 jqGrid 将使用的新过滤器不会有问题(请参阅演示 此处)。

The behavior of the bottom bar with the navigator is correct because it is implemented not as the part of grid. So you really have to set it additionally. You can write you own export and import of the settings.

The situation with the additional last line which will be added in the searching dialog is really a small problem which can be fixed with the following code:

var grid = $("#list");
...

grid.searchGrid(prmSearch);
if (typeof(grid[0].p.postData.filters) === "string" &&
    grid[0].p.postData.filters.length>0) {

    $("#fbox_"+grid[0].id).searchFilter().del();
}
$("#fbox_"+grid[0].id).searchFilter().close();

You can see the corresponding demo here. It is a small modification of the demo from my another old answer.

By the way the new filter which will be used in the next version of jqGrid will not have the problem (see the demo here).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文