gpt4 book ai didi

jqgrid - 添加对话框未关闭后

转载 作者:行者123 更新时间:2023-12-04 17:11:16 26 4
gpt4 key购买 nike

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

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

最佳答案

有一些用于关闭对话框的属性需要在您的编辑/添加声明中设置,它们通常默认为 false。

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

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

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

{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 上可用

关于jqgrid - 添加对话框未关闭后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12092147/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com