From d135090ab72cf60f1d6fa5767049c28c7c7d1e58 Mon Sep 17 00:00:00 2001 From: daimian Date: Tue, 1 Jul 2014 10:33:28 -0500 Subject: [PATCH 1/3] Select row for Fixed Columns plugin Simply adds/removes the class to the Fixed Columns plugin clones as needed. --- js/dataTables.tableTools.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/js/dataTables.tableTools.js b/js/dataTables.tableTools.js index 89a0b52..05af8e2 100755 --- a/js/dataTables.tableTools.js +++ b/js/dataTables.tableTools.js @@ -1634,6 +1634,20 @@ TableTools.prototype = { if ( data[i].nTr ) { $(data[i].nTr).addClass( that.classes.select.row ); + + // Update Fixed Columns plugin + if ( typeof that.s.dt._oFixedColumns !== 'undefined' ) + { + if ( that.s.dt._oFixedColumns.dom.clone.left.body ) + { + $(that.s.dt._oFixedColumns.dom.clone.left.body.rows[data[i].nTr.rowIndex]).addClass( that.classes.select.row ); + } + + if ( that.s.dt._oFixedColumns.dom.clone.right.body ) + { + $(that.s.dt._oFixedColumns.dom.clone.right.body.rows[data[i].nTr.rowIndex]).addClass( that.classes.select.row ); + } + } } } @@ -1683,6 +1697,17 @@ TableTools.prototype = { if ( data[i].nTr ) { $(data[i].nTr).removeClass( that.classes.select.row ); + + // Update Fixed Columns plugin + if ( typeof that.s.dt._oFixedColumns !== 'undefined' ) { + if ( that.s.dt._oFixedColumns.dom.clone.left.body ) { + $(that.s.dt._oFixedColumns.dom.clone.left.body.rows[data[i].nTr.rowIndex]).removeClass( that.classes.select.row ); + } + + if ( that.s.dt._oFixedColumns.dom.clone.right.body ) { + $(that.s.dt._oFixedColumns.dom.clone.right.body.rows[data[i].nTr.rowIndex]).removeClass( that.classes.select.row ); + } + } } } From 102cd3b11881669da221fcd4fe99640ed22d9e19 Mon Sep 17 00:00:00 2001 From: daimian Date: Tue, 1 Jul 2014 17:05:00 -0500 Subject: [PATCH 2/3] Revert "Select row for Fixed Columns plugin " This reverts commit 672b3c31dba69805b5476cc5c451fc0faa10a293. --- js/dataTables.tableTools.js | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/js/dataTables.tableTools.js b/js/dataTables.tableTools.js index 05af8e2..89a0b52 100755 --- a/js/dataTables.tableTools.js +++ b/js/dataTables.tableTools.js @@ -1634,20 +1634,6 @@ TableTools.prototype = { if ( data[i].nTr ) { $(data[i].nTr).addClass( that.classes.select.row ); - - // Update Fixed Columns plugin - if ( typeof that.s.dt._oFixedColumns !== 'undefined' ) - { - if ( that.s.dt._oFixedColumns.dom.clone.left.body ) - { - $(that.s.dt._oFixedColumns.dom.clone.left.body.rows[data[i].nTr.rowIndex]).addClass( that.classes.select.row ); - } - - if ( that.s.dt._oFixedColumns.dom.clone.right.body ) - { - $(that.s.dt._oFixedColumns.dom.clone.right.body.rows[data[i].nTr.rowIndex]).addClass( that.classes.select.row ); - } - } } } @@ -1697,17 +1683,6 @@ TableTools.prototype = { if ( data[i].nTr ) { $(data[i].nTr).removeClass( that.classes.select.row ); - - // Update Fixed Columns plugin - if ( typeof that.s.dt._oFixedColumns !== 'undefined' ) { - if ( that.s.dt._oFixedColumns.dom.clone.left.body ) { - $(that.s.dt._oFixedColumns.dom.clone.left.body.rows[data[i].nTr.rowIndex]).removeClass( that.classes.select.row ); - } - - if ( that.s.dt._oFixedColumns.dom.clone.right.body ) { - $(that.s.dt._oFixedColumns.dom.clone.right.body.rows[data[i].nTr.rowIndex]).removeClass( that.classes.select.row ); - } - } } } From a14b496f2f8bb81c4dc079ab7bb524e713d43e0f Mon Sep 17 00:00:00 2001 From: daimian Date: Wed, 2 Jul 2014 08:18:25 -0500 Subject: [PATCH 3/3] Selectable rows via Fixed Columns Simply adds a check if user click a row in a Fixed Column table and gets the correct row from the original datatable via row index. --- js/dataTables.tableTools.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/dataTables.tableTools.js b/js/dataTables.tableTools.js index 89a0b52..0b9e80e 100755 --- a/js/dataTables.tableTools.js +++ b/js/dataTables.tableTools.js @@ -1497,9 +1497,9 @@ TableTools.prototype = { // Row selection $(dt.nTBody).on( 'click.DTTT_Select', this.s.custom.sRowSelector, function(e) { - var row = this.nodeName.toLowerCase() === 'tr' ? - this : - $(this).parents('tr')[0]; + var row = e.delegateTarget.offsetParent.className.indexOf('DTFC_Cloned') > -1 ? + dt.nTBody.rows[this.rowIndex -1] : + this.nodeName.toLowerCase() === 'tr' ? this : $(this).parents('tr')[0]; var select = that.s.select; var pos = that.s.dt.oInstance.fnGetPosition( row );