From 0f239463159bb9cb126c3084dc3899016ac7a2e8 Mon Sep 17 00:00:00 2001 From: Dar Date: Fri, 23 May 2014 18:52:20 +0500 Subject: [PATCH] Update fixedheadertable.js create 'thead' out of the first row for tables without a thead, if 'nothead' class is specified Useful for asp net --- jquery.fixedheadertable.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/jquery.fixedheadertable.js b/jquery.fixedheadertable.js index 1d052d8..10b4a3d 100644 --- a/jquery.fixedheadertable.js +++ b/jquery.fixedheadertable.js @@ -307,10 +307,19 @@ */ _isTable: function($obj) { var $self = $obj, - hasTable = $self.is('table'), - hasThead = $self.find('thead').length > 0, - hasTbody = $self.find('tbody').length > 0; - + hasTable = $self.is('table'), + hasThead = $self.find('thead').length > 0, + hasTbody = $self.find('tbody').length > 0, + createThead = $self.hasClass('nothead'); + + // tables without a thead + // create thead out of the first row + // if nothead class is specified + if (hasTable && !hasThead && createThead) { + $self.prepend($('').append($self.find('tr:first').remove())); + hasThead = true; + } + if (hasTable && hasThead && hasTbody) { return true; }