【问题标题】:jqGrid "_search" parameter is false all the timejqGrid“_search”参数一直为假
【发布时间】:2017-05-08 10:38:44
【问题描述】:

我在我的代码中使用 jqGrid 并且有一点问题。
这是来自asd.jsp的代码:

jQuery().ready(function ()
{

    $("#myGridId").jqGrid({
        url: "getListAsd.jsp",
        datatype: "json",
        colNames: ['menu', 'name', 'price'], 
        colModel: [
            {index: "menu", width: 250, sortable: true, editable: true, edittype: "text"},
            {index: "name", width: 250, sortable: true, editable: true, edittype: "text"},
            {index: "price", width: 100, sortable: true, editable: true, edittype: "text", align: "right"}
        ],
        rowNum: 35,
        height: 780,
        autowidth: false,
        sortname: "price",
        sortorder: "desc", 
        viewrecords: true,         
        pager: '#gridpager',
    })                
            .jqGrid('filterToolbar', { searchOnEnter: true, enableClear: true }) // make search available in each column
            .navGrid('#gridpager', {edit: true, add: true, del: true, search: false, view: false},
                    {multipleSearch: true} // search options
            );
});

这是来自getListAsd.jsp的代码:

if (request.getParameter("_search") != null) {
    search = java.lang.Boolean.parseBoolean(request.getParameter("_search"));
}
if (search) {
    // some search things here...
}

在 gridpager 中,我需要 search: false,因为我想在每一列中进行搜索,而不是使用默认搜索按钮。
所以问题是_search 总是错误的。

【问题讨论】:

    标签: jquery jsp jqgrid


    【解决方案1】:

    问题解决了。 jqGrid 似乎需要name 属性才能正确执行列内搜索。
    来自asd.jsp的新代码:

    colModel: [
            {name: "menu", index: "menu", width: 250, sortable: true, editable: true, edittype: "text"},
            {name: "name", index: "name", width: 250, sortable: true, editable: true, edittype: "text"},
            {name: "price", index: "price", width: 100, sortable: true, editable: true, edittype: "text", align: "right"}
        ],
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-01
      • 2017-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-03
      相关资源
      最近更新 更多