admin管理员组文章数量:1431770
Hi I am facing some issue with KTDatatable dropdown edit for each row, datatable.on(‘click’, is not picking my click event, please help.
The click event is from bootstrap dropdown,
My code is as follows //Datatable code var KTDatatableRecordSelectionDemo = function() { //..... //..... columns: [{ }, //..... { field: 'Actions', title: 'Actions', template: function(row) { return '\\\\\\ Organization Details\class="dropdown-item" href="#"> Location and contact detials\ Tax settings and bank details\ Access rights\class="dropdown-item" href="#" id="one_another"> Profile image and print logo\\\';},}]
and here below the init datatable function
var localSelectorDemo = function() {
var datatable = $('#organizations').KTDatatable(options);
//....
//....
datatable.on('click', '#form_organisation_details', function() {
var dataId = $(this).attr("data-id");
console.log(dataId);
}
}
}
Hi I am facing some issue with KTDatatable dropdown edit for each row, datatable.on(‘click’, is not picking my click event, please help.
The click event is from bootstrap dropdown,
My code is as follows //Datatable code var KTDatatableRecordSelectionDemo = function() { //..... //..... columns: [{ }, //..... { field: 'Actions', title: 'Actions', template: function(row) { return '\\\\\\ Organization Details\class="dropdown-item" href="#"> Location and contact detials\ Tax settings and bank details\ Access rights\class="dropdown-item" href="#" id="one_another"> Profile image and print logo\\\';},}]
and here below the init datatable function
var localSelectorDemo = function() {
var datatable = $('#organizations').KTDatatable(options);
//....
//....
datatable.on('click', '#form_organisation_details', function() {
var dataId = $(this).attr("data-id");
console.log(dataId);
}
}
}
Share
Improve this question
edited Jul 29, 2019 at 8:57
user3387166
asked Jul 28, 2019 at 4:39
user3387166user3387166
311 silver badge4 bronze badges
2 Answers
Reset to default 3you can't use onClick directly because the table was not initialized instead use something like this to add the click event after the table is loaded.
$(table_id).on('click', '.btn-edit', function(e){
e.preventDefault();
$.ajax({
type: 'get',
url: 'some link here',
success: function (data) {
$("#response").html(data);
},
});
});
and in the table itself use something like this to add the button in the table row
return Datatables::of($data)->addColumn('actions',function($row){
return '<a title="Edit" class="btn-edit"><i class="la la-edit"></i></a>';
})->rawColumns(['actions'])->make(true);
Try to remove dompurify from the build.json config assets. This plugin sanitizes the datatable custom HTML template option.
版权声明:本文标题:javascript - JQuery .on('click') is not working with KTDatatable each row edit dropdown menu - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745588377a2665048.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论