Vivek Vivek - 1 year ago 90
CSS Question

Freeze table header in jquery

I am trying to freeze table header. I am using this plugin to achieve the same.

When I used this plugin I got

this.table_obj is undefined
. I tried to find out what's the problem but couldn't get the solution.
When I tried this code in plain html file it works, but not on server side.
you can see the error here..

Any suggestion why I am getting this error?

Answer Source

i have written fallowing code in order to achieve my goal(as asked in question)-

here is the plugin i have written.

var o={};
else if(typeof(i)=='object')o=i;
else if(typeof(i)=='undefined')o={height:300}
return this.each(function(){
var $t=$(this);
var w=$t.width();
    var parent,child;
        parent=$('<div style="width:50px;height:50px;overflow:auto"><div style="height:50px;"></div></div>').appendTo('body');
    return width;
var cols=[];
var tableCols=[];
$t.find('thead th,thead td').each(function(){cols.push($(this).width());});
$t.find('tr:eq(1) th,thead td').each(function(){tableCols.push($(this).width());});
var $firstRow=$t.clone();
$firstRow.find('thead th,thead td').each(function(i){$(this).attr('width',cols[i]);});
$t.find('tr:first th,tr:first td').each(function(i){$(this).attr('width',tableCols[i]);});
var $wrap=$('<div>');

How to use:


hope it will help someone somewhere..

Any way thanks to all of you for your kind support... :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download