HaB*_*aBo 4 model-view-controller grid jquery refresh telerik
嗨,我有两个MVC Telerik网格在一个视图中出现.
每个网格都有一个带有编辑链接的自定义列
当用户单击编辑链接时,对话框模型将弹出一个表单,并在用户点击保存按钮后.脚本下面会运行
function OpenStopForm() {
$("#dialog:ui-dialog").dialog("destroy");
$("#dialog-model").dialog({
height: 220,
width: 340,
modal: true,
buttons: {
"Save": function () {
var note = $('textarea[name=StopNote]').val();
$.ajax({
type: "POST",
url: "/Medication/StopMedication",
data: { ID: pid, StopNote: note },
dataType: "json",
success: refreshGrid()
});
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
在上面的函数成功运行之后,
我希望两个telerik网格能够通过某种ajax调用进行刷新.
我虽然调用了这样的功能
:refreshGrid
function refreshGrid() {
$('#CurrentMedication').data('t-grid').ajaxRequest();
}
Run Code Online (Sandbox Code Playgroud)
但是在执行Controller操作之前调用了refreshGrid函数.
我希望在控制器操作完成后调用此函数.
我不确定我的语法是否正确!
我试着从这里做点什么
任何人都可以帮助我在ajax Post上成功调用refreshgrid函数.另外请用我的功能来更正网格.
HaB*_*aBo 10
我已经修改了我的ajax调用,如下所示
$.ajax({
type: "POST",
url: "/Medication/StopMedication",
data: { ID: pid, StopNote: note },
dataType: "text",
success: function (data) {
refreshGrid();
}
})
Run Code Online (Sandbox Code Playgroud)
我的刷新网格是这样的
function refreshGrid() {
$(".t-grid .t-refresh").trigger('click');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9493 次 |
| 最近记录: |