在页面加载期间调用JqGrid,但是下次在按钮上调用它时,它不会被调用

时间:2016-05-18 12:38:45

标签: jqgrid

    $(document).ready(function () {
        BindGrid('', '', '', '', 1, 2, '', '', sessionStorage.UserID);

    });
    function Search() {
        $('#modal_Advance_Search').modal('hide');
        var channelselected = $('#dd_channel option:selected');
        var channelarray = [];
        $(channelselected).each(function (index, channelsel) {
            channelarray.push([$(this).val()]);
        });
        var Channel = channelarray.toString();

        var Distselected = $('#dd_dist_category option:selected');
        var Distarray = [];
        $(Distselected).each(function (index, channelsel) {
            Distarray.push([$(this).val()]);
        });
        var DistributorCategory = Distarray.toString();

        var ARNNo = "";
        var token = $("#txt_arn").tokenInput("get");
        var names = [];

        $.each(token, function (i, obj) {
            names.push(obj.name);//build an array of just the names
        });
        ARNNo = names.toString();

        sessionStorage.setItem("DistributorCategoryMaster", DistributorCategory);
        sessionStorage.setItem("ChannelCreateMaster", Channel);
        sessionStorage.setItem("ARNCreateMaster", ARNNo);

        sessionStorage.setItem("ismasterqueue", true);

        $("#hdr_name").text("Master Q");

        $("#spn_user_name").text(sessionStorage.UserName);
        $("#spn_role_name").text(sessionStorage.RoleName);

        BindGrid(ARNNo, Channel, '', DistributorCategory, 1, 2, Utility.ListSearchText, '', sessionStorage.UserID)

    }
    function BindGrid(ArnNo1, Channel1, ARNName1, DistributorCategory1, Status1, MasterQueueStatus1, SearchFilter1, MemoLevel1, UserID1) {


        $("#tbl_masterqueue").jqGrid({

            url: "/Pages/MSQ.aspx/GetCreateBaseRackRate",

            mtype: 'POST',
            postData:
            {
                ArnNo: ArnNo1, Channel: Channel1, ARNName: ARNName1, DistributorCategory: DistributorCategory1, Status: Status1, MasterQueueStatus: MasterQueueStatus1, SearchFilter: SearchFilter1, MemoLevel: MemoLevel1, UserID: UserID1

            },
            datatype: "json",
            ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
            serializeGridData: function (postData) {
                return JSON.stringify(postData);
            },
            jsonReader: {
                repeatitems: false,
                root: function (obj) { return obj.d; }
            },
            colNames: ['Select', 'Memoid', 'Memo Number', 'Memo Type', 'Memo Type ID', 'Category', 'ARN No', 'ARN Name', 'Date From', 'Date To', 'Status', 'Status', 'Raised By', 'Raised On', 'Time', 'Ageing', 'Last Action By', 'Pending With'],
            colModel: [
                    { name: 'edi', index: 'edi', formatter: MasterQueue.ReturnRadioBox, width: '60px;', disabled: true, hidden: true, sortable: false },
                     { name: 'PaymentMemoId', index: 'PaymentMemoId', width: 120, hidden: true, sortable: false },
                    { name: 'MemoNumber', index: 'MemoNumber', align: 'center', formatter: MasterQueue.ReturnSearchHyperLink, sortable: false },
                    { name: 'MemoTypeName', index: 'MemoTypeName', width: 120, sortable: false },
                    { name: 'MemoTypeID', index: 'MemoTypeID', hidden: true, sortable: false },
                    { name: 'DistributorCategoryName', index: 'DistributorCategoryName', width: 260, sortable: false },
                    { name: 'ARNNo', index: 'ARNNo', width: 90, sortable: false },
                    { name: 'ARNName', index: 'ARNName', width: 260, sortable: false },
                    { name: 'DateFrom', index: 'DateFrom', sorttype: "date", align: 'center', width: 90, sortable: false },
                    { name: 'DateTo', index: 'DateTo', align: 'center', width: 90, sortable: false },
                    { name: 'MemoStatus', index: 'MemoStatus', align: 'center', width: 90, hidden: true, sortable: false },
                     { name: 'MemoStatusDisplay', index: 'MemoStatusDisplay', align: 'center', width: 90, sortable: false },
                    { name: 'CreatedByName', index: 'CreatedByName', align: 'left', sortable: false },
                    { name: 'RaisedOnDate', index: 'RaisedOnDate', width: 90, align: 'center', sortable: false },
                    { name: 'RaisedOnTime', index: 'RaisedOnTime', width: 50, align: 'center', sortable: false },
                    { name: 'Ageing', index: 'Ageing', width: 70, align: 'right', sortable: false },
                    { name: 'ModifiedByName', index: 'ModifiedByName', align: 'left', sortable: false },
                     { name: 'PendingWith', index: 'PendingWith', align: 'left', sortable: false },
            ],
            rowNum: 100,
            rowList: [100, 200, 300, 400, 500],
            pager: '#pager',
            sortname: 'PaymentMemoId',
            viewrecords: true,
            sortorder: "desc",
            gridview: true,
            height: '510px',
            loadonce: true,
            gridview: true

        });
        jQuery("#tbl_masterqueue").jqGrid('navGrid', '#pager', { add: false, edit: false, del: false, search: true, refresh: true },
                   {}, {}, {}, { multipleSearch: true, multipleGroup: true, showQuery: true });
    }

我在页面加载期间创建了一个绑定网格的方法,它工作正常,但是当在按钮上点击过滤/搜索时调用相同的方法时,此方法无效。我正在使用JQGrid,请帮助解决。

0 个答案:

没有答案