答案 0 :(得分:0)
您可以覆盖网格._showMessage
函数,并将kendo.confirm
调用置于其中。 kendo.confirm
是一个承诺,.done()
处理程序将对应于发生的OK(是,删除记录)按钮,并在其中删除该行。
$("#grid").kendoGrid({
…
… grid configuration …
…
});
var grid = $("#grid").getKendoGrid();
// save reference to original _showMessage, just in case
grid.__showMessage = grid._showMessage;
// override _showMessage that the grid._confirmation uses
grid._showMessage = function (messages, row) {
kendo.confirm(messages.title) // open kendo confirm dialog which is also promise
.done(function() {
// done is confirm promise callback for OK
grid._removeRow(row);
});
return false;
}
请注意,由于confirm
是一个承诺,_showMessage
将向内部_confirmation
返回false,这不会立即删除该行。取而代之的是,单击确认对话框中的“确定” /“取消”按钮将解决承诺,并且将运行“确定”操作处理程序,然后将对覆盖闭包内引用的行执行删除操作。
答案 1 :(得分:0)
非常感谢您的答复。
在这里,我提供了一个成功的工作演示,供您参考。 Demo Here!
基本上,它需要创建一个自定义按钮并在单击时定义功能。
mysqli
MysqlI Support => enabled
Client API library version => mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
Active Persistent Links => 0
Inactive Persistent Links => 0
Active Links => 0
Directive => Local Value => Master Value
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
mysqli.rollback_on_cached_plink => Off => Off
mysqlnd
mysqlnd => enabled
Version => mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
Compression => supported
core SSL => supported
extended SSL => supported
Command buffer size => 4096
Read buffer size => 32768
Read timeout => 86400
Collecting statistics => Yes
Collecting memory statistics => No
Tracing => n/a
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password
API Extensions => mysqli,pdo_mysql
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.0g 2 Nov 2017
OpenSSL Header Version => OpenSSL 1.1.0g 2 Nov 2017
Openssl default config => /usr/lib/ssl/openssl.cnf
Directive => Local Value => Master Value
openssl.cafile => no value => no value
openssl.capath => no value => no value