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 

});
4

1 回答 1

0

如果我的理解正确,则每次访问该页面时,您都需要过滤后的内容可用于整个会话。它可以通过将您的 postData 值发送到服务器(无论您使用什么)并为过滤网格组成值来轻松完成。将新数据列表设置为会话并在您访问页面时再次加载数据。在您的情况下,您需要使用以下值查询您的数据库,

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.
    }
});
}

希望你有一些方向。让我知道这是否对您有帮助..

于 2013-09-28T10:32:44.370 回答