I am using tablesorter jquery to sort the column in my table. I want to freeze my table header. Is there any way to do that using tablesorter jquery? Thanks in advance.
My tablesorter code:
("#rates").tablesorter({
widgets: ['zebra'],
widgetZebra: {
css: ["even", "odd"]
},
headers: {
0: {
sorter: false
},
4: {
sorter: false
}
},
headerClass: 'header',
sortClassAsc: 'headerSortUp',
sortClassDesc: 'headerSortDown'
});
I also tried this.
widgetOptions: {
stickyHeaders : 'tablesorter-stickyHeader',
},
I am using tablesorter jquery to sort the column in my table. I want to freeze my table header. Is there any way to do that using tablesorter jquery? Thanks in advance.
My tablesorter code:
("#rates").tablesorter({
widgets: ['zebra'],
widgetZebra: {
css: ["even", "odd"]
},
headers: {
0: {
sorter: false
},
4: {
sorter: false
}
},
headerClass: 'header',
sortClassAsc: 'headerSortUp',
sortClassDesc: 'headerSortDown'
});
I also tried this.
widgetOptions: {
stickyHeaders : 'tablesorter-stickyHeader',
},
Share
Improve this question
edited Jun 21, 2013 at 9:16
kishore
asked Jun 21, 2013 at 7:41
kishorekishore
1,6475 gold badges16 silver badges17 bronze badges
2
-
1
Your code is missing
$
orjQuery
? – Broxzier Commented Jun 21, 2013 at 8:01 -
Please note the stickyHeaders widget &
widgetOptions
only work with this fork of tablesorter, not the original from tablesorter.; Tablesorter (either version) does not include options likeheaderClass
,sortClassAsc
,sortClassDesc
. And lastly, the forked version moved thewidgetZebra
option intowidgetOptions
aszebra
. – Mottie Commented Feb 20, 2015 at 13:45
2 Answers
Reset to default 2You can add this to your tablesorter initialization:
$(‘table’).tablesorter({
widgets: ['stickyHeaders']}
)
This would activate 1st row freezing automatically. Make sure to remove exisitng scrolling techniques like: overflow: auto;
See my post about this and how to add your custom HTML header, if needed. Please let me know if it helps :)
Use this code to stick your table header:
widgetOptions: {
// css class name applied to the sticky header row (tr)
stickyHeaders : 'tablesorter-stickyHeader',
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745618447a4636376.html
评论列表(0条)