mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Scroller & columnSelector: integrate widgets. Fixes #905
This commit is contained in:
parent
7c46c9e02e
commit
bbe5d53e14
@ -239,7 +239,12 @@ $(function() {
|
||||
</li>
|
||||
<li>Fixed slow mousewheel scrolling when a fixed column is active in Firefox & older versions of Internet Explorer.</li>
|
||||
<li>Fixed filtering of table content causing the fixed column to misalign; especially when few to no results are found.</li>
|
||||
<li>The scroller now integrates smoothly with the pager widget.</li>
|
||||
<li>Added compatibility to the following widgets:
|
||||
<ul>
|
||||
<li>pager</li>
|
||||
<li>columnSelector</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Thanks to <a href="https://github.com/TheSin-">TheSin-</a> for all the work he put into updating this widget... he really didn't like that scrollbar under the fixed column LOL.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -27,8 +27,7 @@ tsColSel = ts.columnSelector = {
|
||||
}
|
||||
|
||||
// unique table class name
|
||||
c.tableId = 'tablesorter' + new Date().getTime();
|
||||
c.$table.addClass( c.tableId );
|
||||
c.$table.addClass( c.namespace.slice(1) + 'columnselector' );
|
||||
|
||||
// build column selector/state array
|
||||
colSel = c.selector = { $container : $(wo.columnSelector_container || '<div>') };
|
||||
@ -205,9 +204,9 @@ tsColSel = ts.columnSelector = {
|
||||
},
|
||||
|
||||
updateBreakpoints: function(c, wo) {
|
||||
var priority, column, breaks,
|
||||
var priority, column, breaks, temp,
|
||||
colSel = c.selector,
|
||||
prefix = '.' + c.tableId,
|
||||
prefix = c.namespace + 'columnselector',
|
||||
mediaAll = [],
|
||||
breakpts = '';
|
||||
if (wo.columnSelector_mediaquery && !colSel.auto) {
|
||||
@ -222,9 +221,12 @@ tsColSel = ts.columnSelector = {
|
||||
breaks = [];
|
||||
c.$headers.filter('[' + wo.columnSelector_priority + '=' + (priority + 1) + ']').each(function(){
|
||||
column = parseInt($(this).attr('data-column'), 10) + 1;
|
||||
breaks.push(prefix + ' col:nth-child(' + column + ')');
|
||||
breaks.push(prefix + ' tr th:nth-child(' + column + ')');
|
||||
breaks.push(prefix + ' tr td:nth-child(' + column + ')');
|
||||
temp = ' col:nth-child(' + column + ')';
|
||||
breaks.push(prefix + temp + ',' + prefix + '_extra_table' + temp);
|
||||
temp = ' tr th:nth-child(' + column + ')';
|
||||
breaks.push(prefix + temp + ',' + prefix + '_extra_table' + temp);
|
||||
temp = ' tr td:nth-child(' + column + ')';
|
||||
breaks.push(prefix + temp + ',' + prefix + '_extra_table' + temp);
|
||||
});
|
||||
if (breaks.length) {
|
||||
mediaAll = mediaAll.concat( breaks );
|
||||
@ -247,16 +249,19 @@ tsColSel = ts.columnSelector = {
|
||||
if (wo.columnSelector_mediaquery && c.selector.auto || c.selector.isInitializing) {
|
||||
return;
|
||||
}
|
||||
var column,
|
||||
var column, temp,
|
||||
colSel = c.selector,
|
||||
styles = [],
|
||||
prefix = '.' + c.tableId;
|
||||
prefix = c.namespace + 'columnselector';
|
||||
colSel.$container.find('input[data-column]').filter('[data-column!="auto"]').each(function(){
|
||||
if (!this.checked) {
|
||||
column = parseInt( $(this).attr('data-column'), 10 ) + 1;
|
||||
styles.push(prefix + ' col:nth-child(' + column + ')');
|
||||
styles.push(prefix + ' tr th:nth-child(' + column + ')');
|
||||
styles.push(prefix + ' tr td:nth-child(' + column + ')');
|
||||
temp = ' col:nth-child(' + column + ')';
|
||||
styles.push(prefix + temp + ',' + prefix + '_extra_table' + temp);
|
||||
temp = ' tr th:nth-child(' + column + ')';
|
||||
styles.push(prefix + temp + ',' + prefix + '_extra_table' + temp);
|
||||
temp = ' tr td:nth-child(' + column + ')';
|
||||
styles.push(prefix + temp + ',' + prefix + '_extra_table' + temp);
|
||||
}
|
||||
$(this).toggleClass( wo.columnSelector_cssChecked, this.checked );
|
||||
});
|
||||
|
@ -277,7 +277,7 @@ ts.scroller = {
|
||||
});
|
||||
|
||||
// Sorting, so scroll to top
|
||||
tmp = 'sortEnd setFixedColumnSize updateComplete pagerComplete pagerInitialized '
|
||||
tmp = 'sortEnd setFixedColumnSize updateComplete pagerComplete pagerInitialized columnUpdate '
|
||||
.split( ' ' )
|
||||
.join( namespace + ' ' );
|
||||
$table
|
||||
@ -305,7 +305,8 @@ ts.scroller = {
|
||||
ts.scroller.resize( c, wo );
|
||||
}
|
||||
})
|
||||
.on( 'updateComplete pagerComplete pagerInitialized '.split( ' ' ).join( namespace + ' ' ), function() {
|
||||
.on( 'updateComplete pagerComplete pagerInitialized columnUpdate '
|
||||
.split( ' ' ).join( namespace + ' ' ), function() {
|
||||
// adjust column sizes after an update
|
||||
ts.scroller.resize( c, wo );
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user