1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
| $('#exampleTable').dataTable({ ajax: { url: '/getData', type: 'get', headers: {}, data: function (data) { data.searchName = 'xxxx'; }, dataSrc: function (res) { res.data.map(item => { item.name = '<button>abc</button>'; }) return res.data; } }, buttons: [{ text: "Bulk Make as Completed", className: 'marked-as-complate-btn' }], columns: [ { data: 'name' }, { data: 'status' }, { className: 'test', data: 'id', orderable: true, render: function (data, type, row) { return '<input type="checkbox" class="form-control" value=' + row.value +'>'; }, searchable: false, type: 'date', visible: true, width: '20%', }, ], columnDefs: [{ targets: [0, 1], orderable: false }], createdRow: function (row, data, index) { $(row).addClass('test'); }, data: {}, displayLength: 10,
dom: "<'row'<'col-sm-12 col-md-6'f>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-12 col-md-2'l><'col-sm-12 col-md-2'i><'col-sm-12 col-md-8'p>>", drawCallback: function (settings) { var api = this.api(); console.log( api.rows( {page:'current'} ).data() ); }, info: true, language: { emptyTable: '表中没有可用数据了', info: "_START_ - _END_ of _TOTAL_", infoEmpty: "没有记录", infoFiltered: "从 _MAX_ 条记录中过滤" lengthMenu: '每页显示 _MENU_ 条', loadingRecords: '加载中', processing: '处理中', search: '搜索', zeroRecords: '没有找到符合提交的数据', paginate: { first: '首页', last: '尾页', next: '下一页', previous: '上一页' } }, lengthMenu: [10, 20, 50, 100], ordering: false, paging: false,
pagintType: 'simple_numbers', processing: true, responsive: true, rowReorder: true, rowReorder: { dataSrc: 'order', selector: 'tr td:not(:last-child)' } scrollX: true, searching: false, serverSide: true, });
|