filtertoolbar при перезагрузке страницы не ищет

0

мой код ниже для сетки. попробовал много возможностей. Каждый ответ и предложение приветствуются и оцениваются.

var options = {
        url:inboxGridUrl,
        datatype: 'json',
        mtype: 'GET',
        colNames:['EvaluationId','Policy', 'Task','Status','Condition','Due Date','Eff Date','Agency Name','Agency No','Producer Name','Producer No','Review Start','Location','Task Group'],
        colModel :[ 
                   {name:'uwEvaluationId', label: 'EvaluationId',formatter:'integer',editable: true,hidden:true, frozen : true,editoptions: {disabled: true, size:5}},
                   {name:'policyNum',label: 'Policy',width: 125,editable: true,formatter:formatPolicyLink,editrules: {required: true}},
                   {name:'transactionType',label: 'Task',width: 40,editable: true,editrules: {required: true}},
                   {name:'uwDecision',label: 'Status',width: 50,editable: true,edittype: 'select',editrules: {edithidden:true},editoptions: {required: true}},
                   {name:'taskCondition',label: 'Condition',align: 'left',width: 60,editable: true,
                       editrules: {required: true, integer: true},editoptions: {size:5, maxlength: 4}},
                   {name:'dueDate',label: 'Due Date',align: 'left',width: 70,editable: true,edittype: 'select',editoptions: {required: true}},
                   {name:'policyEffectiveDate',label: 'Eff Date',width: 70,editable: true,edittype: 'select',editrules: {required: true}},
                   {name:'agencyName',label: 'Agency Name',editable: true,width: 120,edittype: 'select',editrules: {required: true}},
                   {name:'agentCode',label: 'Agency No.',editable: true,width: 75,edittype: 'select',editrules: {required: true}},
                   {name:'producerName',label: 'Producer Name',width: 120,editable: true,edittype: 'select',editrules: {required: true}},
                   {name:'producerCode',label: 'Producer No',width: 75,editable: true,edittype: 'select',editrules: {required: true}},
                   {name:'startDate',label: 'Review Start',width: 80,editable: true,edittype: 'select',editrules: {required: true}},
                   {name:'locationCd',label: 'Location',width: 70,editable: true,edittype: 'select',editrules: {required: true}},
                   {name:'groupName',label: 'Task Group',width: 75,editable: true,edittype: 'select',editrules: {required: true}},
                 ],  


        prmNames: {rows: 'max', search: null},
        rowNum:20000,
        height: 'auto',

        sortname: 'id',
        sortable: true,
        forceFit : true,
        repeatitems:true,
        sortorder: 'desc',
        loadonce:true,
        shrinktofit:true,
        datatype: 'json',

        recreateForm:true,
        multipleGroup:true,
        multipleSearch:true,
        multiselect: true,

        gridview: true,
        hidegrid: false,
        viewrecords: true,      
        gridview: true,            
        refreshtitle: "Reload Tasks",
        caption: 'Inbox',
        //code to display sort icons on load
        onSortCol: function (index, idxcol, sortorder) {
            if (this.p.lastsort >= 0 && this.p.lastsort !== idxcol && this.p.colModel[this.p.lastsort].sortable !== false) {
                    $(this.grid.headers[this.p.lastsort].el).find(">div.ui-jqgrid-sortable>span.s-ico").show();
            }
        },
        loadComplete: function() {

            rowCount = $("#taskList").getGridParam("records");
            if (rowCount > 0){
                $("#warningMessage").html("");
                $("#warningBlock").hide();
                $("#recordsCount").html(rowCount);
                $("#messageBlock").show();                  
            } else if (rowCount <= 0) {
                $("#messageBlock").hide();
                $("#warningMessage").html("No Tasks Found");
                $("#warningBlock").show();
            }


        },
        ignoreCase: true,
        jsonReader : {
               root: "rows",
               page: "page",
               total: "total",
               records: "records",
               repeatitems: false,
               cell: "cell",
               id: "uwEvaluationId"
           }    ,
        postData: {filters: {groupOp: "AND", rules: [{field: "policyNum", op: "bw", data: "h" }]}} 

}; 

$("#taskList").jqGrid(options);
$("#taskList").jqGrid('navGrid','#pager',{edit:false,add:false,del:false,search:false,refresh:true});
$("#taskList").jqGrid('filterToolbar', {stringReuslt:true, searchOnEnter:false, defaultSearch:"cn", autoSearch:true 

});
Теги:
jqgrid

1 ответ

0

Если я понял, что вы прав, вам нужно, чтобы отфильтрованный контент был доступен для всего сеанса каждый раз, когда вы посещаете страницу. Это можно легко сделать, отправив ваши значения postData на сервер (независимо от того, что вы используете) и составьте значения для фильтрованной сетки. Установите список новых данных в сеанс и снова загрузите данные, которые вы просматриваете на странице. В вашем случае вам нужно запросить свой db со следующими значениями,

groupOp: "AND", field: "policyNum", op: "bw", data: "h"

Сохраняйте последнее значение поиска в сеансе, и, когда вы переходите на страницу в режиме готовности документа jquery, снова вызовите свои данные, как показано ниже, и заполните свою сетку теми же данными.

function fillJqgrid() {
$.ajax({
    url : "ur_url"
    type : "POST",
    async : false,
    success : function(data) {
        // Data to fill/populate your grid.
    }
});
}

Надеюсь, вы получили какое-то направление. Дайте мне знать, если это вам поможет.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню