Author Topic: Problem using filters - columns don't reset correctly  (Read 1778 times)

glt

  • Newbie
  • *
  • Posts: 8
    • View Profile
Problem using filters - columns don't reset correctly
« on: July 30, 2018, 11:41:04 pm »
Hi,

Using the code below, when I select a value, the filter applies correctly.
But when I revert the selection to --Select--, the columns don't return to
their original order. The new order is strange -it appears partially correct
after the first few rows.

Code is below.

Cheers,
Geoff


Code: [Select]
<div id="grid_array"></div>



<script>
        $(function () {
            //Initialize
            var oSummary = {
                title: "The grid",
                filterModel: {
                    on: true,
                    mode: "AND",
                    header: true,
                    type: "local"
                }
            };
           
            oSummary.colModel = [
                {
                    title: "fname",
                    dataType: "string",
                    dataIndx: "fname",
                    filter: {
                        type: 'select',
                        condition: 'equal',
                        valueIndx: "fname",
                        labelIndx: "fname",
                        prepend: { '': '--Select--' },
                        listeners: ['change']
                    }
                },
                { title: "lname", dataType: "string", dataIndx: "lname" },
                { title: "nt_id", dataType: "string", dataIndx: "nt_id" }
            ];

            oSummary.dataModel = {
                dataType: "JSON",
                location: "remote",
                method: "GET",
                url: "/PQGridPOC/PQGridPOC/Home/PrjReviews",
                getData: function (response) {
                    return { data: response };
                }
            };

            var $grid = $("#grid_array").pqGrid(oSummary);

            //Load filters
            $grid.one("pqgridload", function (evt, ui) {
                var column = $grid.pqGrid("getColumn", { dataIndx: "fname" });
                var filter = column.filter;
                filter.cache = null;
                filter.options = $grid.pqGrid("getData", { dataIndx: ["fname"] });

                $grid.pqGrid("refreshHeader");
            });

        });
</script>