From 075615b004d961da7e6112643e70e5a71a57b5e4 Mon Sep 17 00:00:00 2001 From: Catouse Date: Fri, 7 Nov 2014 17:21:46 +0800 Subject: [PATCH] * added real checkbox input to datatable support checkable. --- src/js/datatable.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/js/datatable.js b/src/js/datatable.js index 74ee9a987..dccaef55b 100644 --- a/src/js/datatable.js +++ b/src/js/datatable.js @@ -48,6 +48,7 @@ checkable: false, // added check icon to the head of rows checkByClickRow: true, // change check status by click anywhere on a row checkedClass: 'active', // apply CSS class to an checked row + checkboxName: null, // Sort options sortable: false, // enable sorter @@ -352,6 +353,7 @@ $rightRow, // $tr, $td, + $cTd, row, rowLen = rows.length, rowCol, @@ -389,7 +391,12 @@ $tr = i < data.flexStart ? $leftRow : ((i >= data.flexStart && i <= data.flexEnd) ? $flexRow : $rightRow); if(i === 0 && checkable) { - $tr.append(''); + $cTd = $(''); + if(options.checkboxName) + { + $cTd.append(''); + } + $tr.append($cTd); } if(cols[i].ignore) continue; @@ -466,10 +473,11 @@ $datatable.append('
'); } - var $oldFooter = $datatable.children('.datatable-footer'); + var $oldFooter = $datatable.children('.datatable-footer').detach(); if (data.footer) { $datatable.append($('