3

当弹出窗口打开并单击更新时,窗口不会关闭

我希望在单击更新时关闭窗口

jsfiddle代码

按钮更新代码

save: function (e) {

            $.ajax({

                url: '/api/apdevice',
                type: 'POST',
                contentType: 'application/json',
                data: JSON.stringify(e.model),

                success: function (data) {
                  alert('yes');

                },

                error: function (data) {
                   alert('no');
                }

            });
        }
4

1 回答 1

4

您需要告诉网格在成功或错误后要做什么。查看网格方法。在这个例子中,我使用了refreshcancelRow

save: function (e) {
    var that = this;
    $.ajax({

        url: '/api/apdevice',
        type: 'POST',
        contentType: 'application/json',
        data: JSON.stringify(e.model),
        success: function (data) {
            alert('yes');
            that.refresh();
        },

        error: function (data) {
            alert('no');
            that.cancelRow();
        }

    });
}

这是一些更新的小提琴:

于 2013-08-12T01:04:02.710 回答