Jqgrid search option not working and edit popups not closed after submit

Posted by Sajith on Stack Overflow See other posts from Stack Overflow or by Sajith
Published on 2014-06-07T03:19:20Z Indexed on 2014/06/07 3:25 UTC
Read the original article Hit count: 619

Filed under:
|
|

i have facing two problem in Jqgrid.

Search option not working and there is not closed editpopups after submit. my code below

<table id="jQGridpending" style="width:auto">
</table>
<div id="jQGridpendingPager">
</div>
<table id="searchpending"></table>
<div id="filterpending"></div>




 jQuery("#jQGridpending").jqGrid({
        url: '@Url.Action("DiscountRequest", "Admin")',
        datatype: "json",
        mtype: "POST",
        colNames: [
            "Id",
                    "ClientName",
                    "BpName",
                    "Pdt",
                    "DiscountReq",
                    "DiscountAllowed",
                    "Status",
        ],
        colModel: [
              { name: "Id", width: 100, key: true, formatter: "integer", sorttype: "integer", hidden: true },
             { name: "ClientName", width: 150, sortable: true,search:true,stype:'text',  editrules: { required: false } },
            { name: "BpName", width: 200, sortable: true, editable: false, editrules: { required: false } },
            { name: "Pdt", width: 150, sortable: true, editable: false, editrules: { required: false } },
            { name: "DiscountReq", width: 150, sortable: false, editable: false, editrules: { required: false } },
            { name: "DiscountAllowed", width: 200, sortable: true, editable: true, editrules: { required: true } },
            { name: 'Status', index: 'Status', width: 200, sortable: false, editable: true, formatter: 'select', edittype: 'select', editoptions: { value: "pending:pending;approved:approved;rejected:rejected" } },
            @* {
                 name: "Status", width: 200, sortable: false,
                 editable: true,
                 editrules: { required: true, minValue: 1, },
                 edittype: "select",
                 editoptions: {
                     async: false,
                     dataUrl: "@Url.Action("GetStatus", "Admin")",
                     buildSelect: function (response) {
                            var s = "<select>";
                            s += '<option value="0">--Select--</option><option value="pending">pending</option>';
                         return s + "</select>";
                     }
                 }
             },*@
             //{ name: "Status", width: 150, sortable: true, editable: true, editrules: { required: true } },
            //{ name: "Created", width: 120, formatter: "date", formatoptions: { srcformat: "ISO8601Long", newformat: "n/j/Y g:i:s A" }, align: "center", sorttype: "date" },
        ],
        loadtext: "Processing pending request data please wait...",
        rowNum: 10,
        gridview: true,
        autoencode: true,
        loadonce: true,
        height: "auto",
        rownumbers: true,
        prmNames: { id: "Id" },
        rowList: [10, 20, 30],
        pager: '#jQGridpendingPager',
        sortname: 'id',
        sortorder: "asc",
        viewrecords: true,
        jqModal: true,
        caption: "Pending List",
        reloadAfterSubmit: true,


        editurl: '@Url.Action("UpdateDiscount", "Admin")',
    });
    jQuery("#jQGridpending").jqGrid('navGrid', '#jQGridpendingPager',
        {
            search: true,recreateFilter: true, 
            add: false,
            searchtext: "Search",
            edittext: "Edit",
            deltext: "Delete",

        },

        {//EDIT
            url: '@Url.Action("UpdateDiscount", "Admin")',
           width: "auto",
           jqModal: true,
           closeOnEscape: true,
           closeAfterEdit: true,
           reloadAfterSubmit: true,
           afterSubmit: function () {
               // Reload grid records after edit a entry in the db.
               $(this).jqGrid('setGridParam', { datatype: 'json' });
               return [true, '', false];
           },

       },
        {//DELETE
            url: '@Url.Action("DelDiscount", "Admin")',
            closeOnEscape: true
        },
         {//SEARCH 
                  closeOnEscape: true,
                  searchOnEnter: true,
                  multipleSearch: true,
                  //overlay: 0,
                  width: "auto",
                  height: "auto",

         });

© Stack Overflow or respective owner

Related posts about jqgrid

Related posts about jqgrid-asp.net