【发布时间】:2020-04-02 05:38:11
【问题描述】:
这是我已经实现并从另一个 crud 控制器获取数据的选项卡
我尝试使用批量操作来选择行并将行的值传递给自定义按钮 但是我做不到
我也尝试过使用 j 查询,但效果不佳
$(document).ready(function (){
// var table = $('#crudtable').DataTable({
// 'data': userData,
// 'columnDefs': [{
// 'targets': 0,
// 'searchable':false,
// 'orderable':false,
// 'className': 'dt-body-center',
// });
// $('.crud_bulk_actions_row_checkbox').on('click', function(){
// // Check/uncheck all checkboxes in the table
// var rows = table.rows({ 'search': 'applied' }).nodes();
// $('.crud_bulk_actions_row_checkbox', rows).prop('checked', this.checked);
// });
// $('#crudtable tbody').on('change', ''.crud_bulk_actions_row_checkbox', function(){
// // If checkbox is not checked
// if(!this.checked){
// var el = $('#example-select-all').get(0);
// if(el && el.checked && ('indeterminate' in el)){
// el.indeterminate = true;
// }
// }
// });
// $('#crudtable').on('#button3', function(e){
// var form = this;
// // Iterate over all checkboxes in the table
// table.$('.crud_bulk_actions_row_checkbox').each(function(){
// // If checkbox doesn't exist in DOM
// if(!$.contains(document, this)){
// // If checkbox is checked
// if(this.checked){
// // Create a hidden element
// $(form).append(
// $('<input>')
// .attr('name', this.name)
// .val(this.value)
// );
// }
// }
// });
// });
// ";
【问题讨论】:
-
可以分享控制器类吗?并解释清楚你想做什么?
标签: jquery laravel-5 checkbox datatables laravel-backpack