After adding a dialog does not close

Below is my code, and I need to close the add / edit dialog after submitting. It updates the server and reloads the grid in both cases, but does not close the dialog:

jQuery("#toolbar1").jqGrid({
     url:'category/getcategorylist',
     datatype: "xml",
     colNames:["Name","Description","Id"],
     colModel:[
         {name:"cname",index:"cname",editable:true, width:250, align:"center",xmlmap:"categoryName"},
         {name:"cdescription",index:"cdescription", editable:true,width:300, align:"center",xmlmap:"description"},
         {name:"id",index:"id", editable:true,width:210, align:"center",xmlmap:"categoryId",key: true,hidden: true},
     ],
     rowNum:100,
     viewrecords: true,
     toppager:true,
     height:250,
     width:800,
     modal:true,
     sortorder: "asc",
     xmlReader: {
        root : "CategoryList",
        row: "categoryList",
        repeatitems: false
     },
});
$("#toolbar1").jqGrid("navGrid", "#toolbar1_toppager", {
     reloadAfterSubmit:true, view: false, search:false ,addtext: 'Add',
     edittext: 'Edit',
     deltext: 'Delete',
     refreshtext: 'Reload'
},
{url: "category/updatecategory"}, {url: "category/createcategory"}, {url:"category/deletecategory"});
+5
source share
2 answers

There are some properties to close the dialog box that needs to be set in edit / add ads, usually they default to false.

For adding:

closeAfterAdd- when adding a mode, close the dialog box after adding an entry. (default: false)

For editing:

closeAfterEdit- in editing mode, close the dialog box after editing. (default: false)

So in your example you will need:

{url: "category/updatecategory", closeAfterEdit: true}, 
{url: "category/createcategory", closeAfterAdd: true}

Or:

$("#toolbar1").jqGrid("navGrid", "#toolbar1_toppager", {
     reloadAfterSubmit:true, view: false, search:false ,addtext: 'Add',
     edittext: 'Edit',
     deltext: 'Delete',
     refreshtext: 'Reload',
     closeAfterAdd: true,
     closeAfterEdit: true
},

These settings are available on the wiki.

+9

:

$('#toolbar1').jqGrid('navGrid', '#toolbar1_toppager', 
            {edit:true,add:true,del:true,search:false}, // options
            {closeAfterEdit:true}, // edit options
            {closeAfterAdd:true},  // add options
            {},   //del options
            {},  // search options
);
+1

All Articles