【发布时间】:2014-07-30 18:28:45
【问题描述】:
我在我的 CRUD 应用程序中使用了 jQuery 的 jTable 插件。我的问题是,当我单击“添加新记录”时,会出现一个确认对话框,但是在填写详细信息并单击“保存”按钮后,该对话框不会消失,但是在我刷新 Jtable 时会添加数据..我怎么能关闭弹出窗口?
我的视图包含
$(document).ready(function () {
$('#StudentTableContainer').jtable({
title: 'Employee List',
paging: true, //Enable paging
sorting: true, //Enable sorting
defaultSorting: 'Name ASC',
//openChildAsAccordion: true, //Enable this line to show child tabes as accordion style
actions: {
listAction: '@Url.Action("Details")',
deleteAction: '@Url.Action("Delete")',
updateAction: '@Url.Action("Update")',
createAction: '@Url.Action("Create")'
},
recordAdded: function (event, data) {
$('#StudentTableContainer').jtable('reload');
},
fields: {
UserId: {
key: true,
create: false,
edit: false,
list: false
},
FirstName: {
title: 'FirstName',
width: '10%'
},
LastName: {
title: 'LastName',
width: '10%'
},
EMail: {
title:'EMail',
width: '10%'
},
Address: {
title: 'Address',
width: '10%'
},
PhoneNo: {
title:'PhoneNo',
width: '10%'
},
Company: {
title:'Company',
width:'10%'
},
Designation: {
title:'Designation',
width:'10%'
}
}
});
//Load person list from server
$('#StudentTableContainer').jtable('load');
我的控制器有 Create 方法包含
[HttpPost] 公共 JsonResult 创建(用户列表用户列表) {
try
{
userRepository.InsertUser(userList);
return Json(new { Result = "OK" });
}
catch (Exception exception)
{
return Json(new { Result = "ERROR", Message = exception.Message });
}
}
【问题讨论】:
标签: jquery asp.net-mvc jtable