jqGrid Trying to apply filter(s) on Grid creation
<p>I have an object that contains the following filter string:</p>

<pre><code>prefs.filters={"groupOp":"AND","rules":[{"field":"FirstName","op":"cn","data":"max"}]}
</code></pre>

<p>Here is my grid create, where I am trying to apply the filters in the postData setting:</p>

<pre><code>        // Set up the jquery grid
        $("#jqGridTable").jqGrid(
            {
                // Ajax related configurations
                url: jqDataUrl,
                datatype: "json",
                mtype: "GET",
                autowidth: true,

                // Configure the columns
                colModel: columnModels,

                // Grid total width and height
                height: "100%",

                // customize jqgrid post init
                gridComplete: function()
                {
                    CRef.updateJqGridPagerIcons("jqGridTable");
                },

                // Paging
                toppager: true,
                rowNum: 20,
                rowList: [5, 10, 20, 50, 100],
                viewrecords: true, // Specify if "total number of records" is displayed

                // Default sorting
                sortname: typeof prefs.sortCol !== "undefined" ? prefs.sortCol : "LastName",
                sortorder: typeof prefs.sortCol !== "undefined" ? prefs.sortOrd :  "asc",
                sorttype: "text",
                sortable: true,

                postData: typeof prefs.filters !== "undefined" ? { filters: prefs.filters } : {},
                //also tried this...
                //postData: typeof prefs.filters !== "undefined" ? { JSON.stringify(filters: prefs.filters) } : {},

 //remaining property settings excluded from post to keep short.
</code></pre>

<p>Update: Using .navGrid on grid as follows:</p>

<pre><code>.navGrid("#jqGridTable",
                { refresh: true, add: false, edit: false, del: false, refreshtitle: getRefreshText('@Model.Instruction'), searchtitle: searchText },
                {}, // settings for edit
                {}, // settings for add
                {}, // settings for delete
                { closeAfterSearch: true, closeOnEscape: true, multipleSearch: true, multipleGroup: true });
</code></pre>

<p>When grid is created, the filter in postData is not applied. I also tried triggering reload event after the initial create and that to did not apply filter either.</p>

<p>From other posts, I believe I'm on correct path, but appear to be missing something.</p>

<p><strong>Update after comments:</strong></p>

<p>I added the following code to loadComplete...</p>

<pre><code>if ($("#jqGridTable").jqGrid("getGridParam", "datatype") === "json") {
    setTimeout(function () {

        $("#jqGridTable").jqGrid("setGridParam", {
            datatype: "local",
            postData: { filters: prefs.filters, sord: prefs.sortOrd, sidx: prefs.sortCol },
            search: true
        });

        $("#jqGridTable").trigger("reloadGrid");
    }, 50);
}
</code></pre>

<p>and it successfully retains the filters. :)</p>

<p>However, now I have interesting issue side effect.  I can sort on columns and some columns will change to sort asc/desc correctly, but when I go to others and sort, they sort but in the order that they originally loaded which is neither asc or desc. </p>