添加对话框未关闭后 [英] After add dialog is not closing

查看:85
本文介绍了添加对话框未关闭后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码,提交后我需要关闭添加/编辑"对话框.在这两种情况下,它都将更新服务器并重新加载网格,但是不会关闭对话框:

Below is my code, and I need to close the add/edit dialog after a submit. It's updating the server and reloading the grid in both the cases, but it is not closing 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"});

推荐答案

有一些用于关闭对话框的属性需要在您的edit/add声明中进行设置,它们通常默认为false.

There are some properties for closing the dialog that needs to be set on your edit/add declarations, they normally default to false.

要添加:

closeAfterAdd-添加模式时,添加记录后关闭对话框. (默认值:false)

closeAfterAdd - when add mode, close the dialog after add record. (default: false)

用于

closeAfterEdit-在编辑模式下,编辑后关闭对话框. (默认值:false)

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

因此在您的示例中,您将需要:

So in your example you would need:

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

或者:

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

这些设置在 wiki 上可用.

这篇关于添加对话框未关闭后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆