重新加载页面后,JqxGrid 过滤器丢失

时间:2021-06-03 12:14:57

标签: html jquery jqwidget

我正在处理一个概览页面,我在其中使用 JqxGrid 显示我们公司中的所有项目。您可以单击一个项目转到下一个页面,您可以在其中查看该项目的详细信息。如果您在概览页面中设置过滤器并转到详细信息页面,您将丢失此过滤器。这不是最用户友好的。我想知道是否有人知道我如何防止这种情况发生?我已经尝试过 jq cookie,但它似乎不起作用。

$(document).ready(function () {
    var sourcePO =
    {
      datatype: "xml",
      datafields: [
        { name: 'Name', type: 'string'},
        { name: 'ID', type: 'string'},
        { name: 'Manufacturer', type: 'string'},
        { name: 'Application', type: 'string'},
        { name: 'Version', type: 'string'},
        { name: 'Status',      type: 'string'},
        { name: 'Product',       type: 'string'},
        { name: 'Requester',    type: 'string'}
      ],
      root: "Data",
      record: "record",
      id: 'id',
      url: "Data.xml",
    };

    var dataAdapterPO = new $.jqx.dataAdapter(sourcePO);
    var DocumentHeight = $(document).height();
    $("#jqxgridPO").jqxGrid(
      {
        theme: 'metro',
        width: '100%',
        height: (DocumentHeight - 250),
        source: dataAdapterPO,
        showfilterrow: true,
        filterable: true,
        sortable: true,
        selectionmode: 'singlerow',
        columnsresize: true,
        columns: [
          { text: 'Name', filtertype: 'textbox', datafield: 'Name',  width: '11%' },
          { text: 'ID', filtertype: 'textbox', datafield: 'ID',  width: '11%' },
          { text: 'Manufacturer', filtertype: 'textbox', datafield: 'Manufacturer',  width: '11%' },
          { text: 'Application', filtertype: 'textbox', datafield: 'Application',  width: '11%' },
          { text: 'Version', filtertype: 'textbox', datafield: 'Version',  width: '4%' },
          { text: 'Status',      filtertype: 'checkedlist', datafield: 'Status',       width: '7%' },
         { text: 'Product',       filtertype: 'textbox', datafield: 'Product',        width: '7%' },
          { text: 'Requester',    filtertype: 'textbox', datafield: 'Requester',     width: '10%' },
        ]
      }
    );
        
          $("#jqxgridPO").on("rowdoubleclick", function (event) {
              var data = $('#jqxgridPO').jqxGrid('getrowdata', event.args.rowindex);
              window.location.assign("../Productdetail.php?id=" + data.Name +  data.ID);
          });

有人知道我在点击产品并前往产品网页后如何保留过滤器吗?特别是复选框类型过滤器。

谢谢!

1 个答案:

答案 0 :(得分:0)

为什么不让您的页面只隐藏网格并在 Modal JQXWindow 中显示产品详细信息,当模态窗口关闭时,再次显示您的网格。

相关问题