nano-lazar 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +8 -0
- data/LICENSE.md +596 -0
- data/README.md +52 -0
- data/VERSION +1 -0
- data/application.rb +185 -0
- data/bin/nano-lazar-start +8 -0
- data/bin/nano-lazar-start.sh +8 -0
- data/bin/nano-lazar-stop +5 -0
- data/bin/nano-lazar-stop.sh +52 -0
- data/config.ru +13 -0
- data/feature-filter.rb +36 -0
- data/helper.rb +1 -0
- data/nano-lazar.gemspec +31 -0
- data/npo.rb +11 -0
- data/public/css/bootstrap.min.css +6 -0
- data/public/css/images/black-asc.gif +0 -0
- data/public/css/images/black-desc.gif +0 -0
- data/public/css/images/black-unsorted.gif +0 -0
- data/public/css/images/bootstrap-black-unsorted.png +0 -0
- data/public/css/images/bootstrap-white-unsorted.png +0 -0
- data/public/css/images/dragtable-handle.png +0 -0
- data/public/css/images/dragtable-handle.svg +7 -0
- data/public/css/images/dropbox-asc-hovered.png +0 -0
- data/public/css/images/dropbox-asc.png +0 -0
- data/public/css/images/dropbox-desc-hovered.png +0 -0
- data/public/css/images/dropbox-desc.png +0 -0
- data/public/css/images/first.png +0 -0
- data/public/css/images/green-asc.gif +0 -0
- data/public/css/images/green-desc.gif +0 -0
- data/public/css/images/green-header.gif +0 -0
- data/public/css/images/green-unsorted.gif +0 -0
- data/public/css/images/ice-asc.gif +0 -0
- data/public/css/images/ice-desc.gif +0 -0
- data/public/css/images/ice-unsorted.gif +0 -0
- data/public/css/images/last.png +0 -0
- data/public/css/images/loading.gif +0 -0
- data/public/css/images/metro-black-asc.png +0 -0
- data/public/css/images/metro-black-desc.png +0 -0
- data/public/css/images/metro-loading.gif +0 -0
- data/public/css/images/metro-unsorted.png +0 -0
- data/public/css/images/metro-white-asc.png +0 -0
- data/public/css/images/metro-white-desc.png +0 -0
- data/public/css/images/next.png +0 -0
- data/public/css/images/prev.png +0 -0
- data/public/css/images/white-asc.gif +0 -0
- data/public/css/images/white-desc.gif +0 -0
- data/public/css/images/white-unsorted.gif +0 -0
- data/public/css/jquery-ui.css +1225 -0
- data/public/css/jquery-ui.theme.min.css +5 -0
- data/public/css/style.css +16 -0
- data/public/css/theme.bootstrap.min.css +1 -0
- data/public/css/theme.default.min.css +1 -0
- data/public/enm-workshop.html +468 -0
- data/public/enm-workshop.rst +98 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +288 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/public/images/Email.png +0 -0
- data/public/images/Facebook.png +0 -0
- data/public/images/Google+.png +0 -0
- data/public/images/IST_logo_s.png +0 -0
- data/public/images/LinkedIn.png +0 -0
- data/public/images/Twitter.png +0 -0
- data/public/images/enm-sm.jpg +0 -0
- data/public/images/enm_logo.png +0 -0
- data/public/images/favicon.ico +0 -0
- data/public/images/ist_logo.png +0 -0
- data/public/images/wait30trans.gif +0 -0
- data/public/javascripts/bootstrap.min.js +7 -0
- data/public/javascripts/google_analytics.js +7 -0
- data/public/javascripts/jquery-1.11.2.min.js +4 -0
- data/public/javascripts/jquery-ui-1.10.3.custom.min.js +6 -0
- data/public/javascripts/jquery.bpopup.min.js +7 -0
- data/public/javascripts/jquery.doubleScroll.js +126 -0
- data/public/javascripts/jquery.tablesorter.min.js +2 -0
- data/public/javascripts/jquery.tablesorter.staticrow.min.js +1 -0
- data/public/javascripts/jquery.tablesorter.widgets.js +2917 -0
- data/public/javascripts/jquery.tools.min.js +5 -0
- data/public/javascripts/lazar-gui.js +11 -0
- data/public/javascripts/nanolazar.js +11 -0
- data/public/javascripts/widget-scroller.js +921 -0
- data/public/ui/small-white/blank.gif +0 -0
- data/public/ui/small-white/framing.css +24 -0
- data/public/ui/small-white/iepngfix.htc +42 -0
- data/public/ui/small-white/opera.css +8 -0
- data/public/ui/small-white/outline.css +16 -0
- data/public/ui/small-white/pretty.css +114 -0
- data/public/ui/small-white/print.css +24 -0
- data/public/ui/small-white/s5-core.css +11 -0
- data/public/ui/small-white/slides.css +10 -0
- data/public/ui/small-white/slides.js +558 -0
- data/unicorn.rb +2 -0
- data/views/layout.haml +95 -0
- data/views/license.haml +1 -0
- data/views/predict.haml +299 -0
- data/views/prediction.haml +152 -0
- metadata +235 -0
@@ -0,0 +1,921 @@
|
|
1
|
+
/*! Widget: scroller - updated 10/31/2015 (v2.24.0) *//*
|
2
|
+
Copyright (C) 2011 T. Connell & Associates, Inc.
|
3
|
+
|
4
|
+
Dual-licensed under the MIT and GPL licenses
|
5
|
+
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
7
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
8
|
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
9
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
10
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
|
+
|
12
|
+
Resizable scroller widget for the jQuery tablesorter plugin
|
13
|
+
|
14
|
+
Version 2.0 - modified by Rob Garrison 4/12/2013;
|
15
|
+
updated 3/5/2015 (v2.22.2) with lots of help from TheSin-
|
16
|
+
Requires jQuery v1.7+
|
17
|
+
Requires the tablesorter plugin, v2.8+, available at http://mottie.github.com/tablesorter/docs/
|
18
|
+
|
19
|
+
Usage:
|
20
|
+
$(function() {
|
21
|
+
$('table.tablesorter').tablesorter({
|
22
|
+
widgets: ['zebra', 'scroller'],
|
23
|
+
widgetOptions : {
|
24
|
+
scroller_height : 300, // height of scroll window
|
25
|
+
scroller_jumpToHeader : true, // header snap to browser top when scrolling the tbody
|
26
|
+
scroller_upAfterSort : true, // scroll tbody to top after sorting
|
27
|
+
scroller_fixedColumns : 0 // set number of fixed columns
|
28
|
+
}
|
29
|
+
});
|
30
|
+
});
|
31
|
+
|
32
|
+
Website: www.tconnell.com
|
33
|
+
*/
|
34
|
+
/*jshint browser:true, jquery:true, unused:false */
|
35
|
+
;( function( $, window ) {
|
36
|
+
'use strict';
|
37
|
+
|
38
|
+
var ts = $.tablesorter,
|
39
|
+
tscss = ts.css;
|
40
|
+
|
41
|
+
$.extend( ts.css, {
|
42
|
+
scrollerWrap : 'tablesorter-scroller',
|
43
|
+
scrollerHeader : 'tablesorter-scroller-header',
|
44
|
+
scrollerTable : 'tablesorter-scroller-table',
|
45
|
+
scrollerFooter : 'tablesorter-scroller-footer',
|
46
|
+
scrollerFixed : 'tablesorter-scroller-fixed',
|
47
|
+
scrollerFixedPanel : 'tablesorter-scroller-fixed-panel',
|
48
|
+
scrollerHasFix : 'tablesorter-scroller-has-fixed-columns',
|
49
|
+
scrollerHideColumn : 'tablesorter-scroller-hidden-column',
|
50
|
+
scrollerHideElement : 'tablesorter-scroller-hidden',
|
51
|
+
scrollerSpacerRow : 'tablesorter-scroller-spacer',
|
52
|
+
scrollerBarSpacer : 'tablesorter-scroller-bar-spacer',
|
53
|
+
scrollerAddedHeight : 'tablesorter-scroller-added-height',
|
54
|
+
scrollerHack : 'tablesorter-scroller-scrollbar-hack',
|
55
|
+
// class name on table cannot start with 'tablesorter-' or the
|
56
|
+
// suffix 'scroller-rtl' will match as a theme name
|
57
|
+
scrollerRtl : 'ts-scroller-rtl'
|
58
|
+
});
|
59
|
+
|
60
|
+
ts.addWidget({
|
61
|
+
id : 'scroller',
|
62
|
+
priority : 60, // run after the filter widget
|
63
|
+
options : {
|
64
|
+
scroller_height : 300,
|
65
|
+
// pop table header into view while scrolling up the page
|
66
|
+
scroller_jumpToHeader : true,
|
67
|
+
// scroll tbody to top after sorting
|
68
|
+
scroller_upAfterSort : true,
|
69
|
+
// set number of fixed columns
|
70
|
+
scroller_fixedColumns : 0,
|
71
|
+
// add hover highlighting to the fixed column (disable if it causes slowing)
|
72
|
+
scroller_rowHighlight : 'hover',
|
73
|
+
// add a fixed column overlay for styling
|
74
|
+
scroller_addFixedOverlay : false,
|
75
|
+
// In tablesorter v2.19.0 the scroll bar width is auto-detected
|
76
|
+
// add a value here to override the auto-detected setting
|
77
|
+
scroller_barWidth : null
|
78
|
+
},
|
79
|
+
format : function( table, c, wo ) {
|
80
|
+
if ( !c.isScrolling ) {
|
81
|
+
// initialize here instead of in widget init to give the
|
82
|
+
// filter widget time to finish building the filter row
|
83
|
+
ts.scroller.setup( c, wo );
|
84
|
+
}
|
85
|
+
},
|
86
|
+
remove : function( table, c, wo ) {
|
87
|
+
ts.scroller.remove( c, wo );
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
/* Add window resizeEnd event (also used by columnSelector widget) */
|
92
|
+
ts.window_resize = function() {
|
93
|
+
if ( ts.timer_resize ) {
|
94
|
+
clearTimeout( ts.timer_resize );
|
95
|
+
}
|
96
|
+
ts.timer_resize = setTimeout( function() {
|
97
|
+
$( window ).trigger( 'resizeEnd' );
|
98
|
+
}, 250 );
|
99
|
+
};
|
100
|
+
|
101
|
+
// Add extra scroller css
|
102
|
+
$( function() {
|
103
|
+
var style = '<style>' +
|
104
|
+
/* overall wrapper & table section wrappers */
|
105
|
+
'.' + tscss.scrollerWrap + ' { position: relative; overflow: hidden; }' +
|
106
|
+
/* add border-box sizing to all scroller widget tables; see #135 */
|
107
|
+
'.' + tscss.scrollerWrap + ' * { box-sizing: border-box; }' +
|
108
|
+
'.' + tscss.scrollerHeader + ', .' + tscss.scrollerFooter + ' { position: relative; overflow: hidden; }' +
|
109
|
+
'.' + tscss.scrollerHeader + ' table.' + tscss.table + ' { margin-bottom: 0; }' +
|
110
|
+
/* always leave the scroll bar visible for tbody, or table overflows into the scrollbar
|
111
|
+
when height < max height (filtering) */
|
112
|
+
'.' + tscss.scrollerTable + ' { position: relative; overflow: auto; }' +
|
113
|
+
'.' + tscss.scrollerTable + ' table.' + tscss.table +
|
114
|
+
' { border-top: 0; margin-top: 0; margin-bottom: 0; overflow: hidden; }' +
|
115
|
+
/* hide footer in original table */
|
116
|
+
'.' + tscss.scrollerTable + ' tfoot, .' + tscss.scrollerHideElement + ', .' + tscss.scrollerHideColumn +
|
117
|
+
' { display: none; }' +
|
118
|
+
|
119
|
+
/*** fixed column ***/
|
120
|
+
/* disable pointer-events on fixed column wrapper or the user can't interact with the horizontal scrollbar */
|
121
|
+
'.' + tscss.scrollerFixed + ', .' + tscss.scrollerFixed + ' .' + tscss.scrollerFixedPanel +
|
122
|
+
' { pointer-events: none; }' +
|
123
|
+
/* enable pointer-events for fixed column children; see #135 & #878 */
|
124
|
+
'.' + tscss.scrollerFixed + ' > div { pointer-events: all; }' +
|
125
|
+
'.' + tscss.scrollerWrap + ' .' + tscss.scrollerFixed + ' { position: absolute; top: 0; z-index: 1; left: 0 } ' +
|
126
|
+
'.' + tscss.scrollerWrap + ' .' + tscss.scrollerFixed + '.' + tscss.scrollerRtl + ' { left: auto; right: 0 } ' +
|
127
|
+
/* add horizontal scroll bar; set to 'auto', see #135 */
|
128
|
+
'.' + tscss.scrollerWrap + '.' + tscss.scrollerHasFix + ' > .' + tscss.scrollerTable + ' { overflow: auto; }' +
|
129
|
+
/* need to position the tbody & tfoot absolutely to hide the scrollbar & move the footer
|
130
|
+
below the horizontal scrollbar */
|
131
|
+
'.' + tscss.scrollerFixed + ' .' + tscss.scrollerFooter + ' { position: absolute; bottom: 0; }' +
|
132
|
+
/* hide fixed tbody scrollbar - see http://goo.gl/VsLe6n - set overflow to auto here for mousewheel scroll */
|
133
|
+
'.' + tscss.scrollerFixed + ' .' + tscss.scrollerTable +
|
134
|
+
' { position: relative; left: 0; overflow: auto; -ms-overflow-style: none; }' +
|
135
|
+
'.' + tscss.scrollerFixed + ' .' + tscss.scrollerTable + '::-webkit-scrollbar { display: none; }' +
|
136
|
+
/*** fixed column panel ***/
|
137
|
+
'.' + tscss.scrollerWrap + ' .' + tscss.scrollerFixedPanel +
|
138
|
+
' { position: absolute; top: 0; bottom: 0; z-index: 2; left: 0; right: 0; } ' +
|
139
|
+
'</style>';
|
140
|
+
$( style ).appendTo( 'body' );
|
141
|
+
});
|
142
|
+
|
143
|
+
ts.scroller = {
|
144
|
+
|
145
|
+
// Ugh.. Firefox misbehaves, so it needs to be detected
|
146
|
+
isFirefox : navigator.userAgent.toLowerCase().indexOf( 'firefox' ) > -1,
|
147
|
+
// old IE needs a wrap to hide the fixed column scrollbar; http://stackoverflow.com/a/24408672/145346
|
148
|
+
isOldIE : document.all && !window.atob,
|
149
|
+
isIE : ( document.all && !window.atob ) || navigator.appVersion.indexOf( 'Trident/' ) > 0,
|
150
|
+
// http://stackoverflow.com/questions/7944460/detect-safari-browser - needed to position scrolling body
|
151
|
+
// when the table is set up in RTL direction
|
152
|
+
isSafari : navigator.userAgent.toLowerCase().indexOf( 'safari' ) > -1 &&
|
153
|
+
navigator.userAgent.toLowerCase().indexOf( 'chrome' ) === -1,
|
154
|
+
|
155
|
+
hasScrollBar : function( $target, checkWidth ) {
|
156
|
+
if ( checkWidth ) {
|
157
|
+
return $target.get(0).scrollWidth > $target.width();
|
158
|
+
} else {
|
159
|
+
return $target.get(0).scrollHeight > $target.height();
|
160
|
+
}
|
161
|
+
},
|
162
|
+
|
163
|
+
setWidth : function( $el, width ) {
|
164
|
+
$el.css({
|
165
|
+
'width' : width,
|
166
|
+
'min-width' : width,
|
167
|
+
'max-width' : width
|
168
|
+
});
|
169
|
+
},
|
170
|
+
|
171
|
+
// modified from http://davidwalsh.name/detect-scrollbar-width
|
172
|
+
getBarWidth : function() {
|
173
|
+
var $div = $( '<div>' ).css({
|
174
|
+
'position' : 'absolute',
|
175
|
+
'top' : '-9999px',
|
176
|
+
'left' : 0,
|
177
|
+
'width' : '100px',
|
178
|
+
'height' : '100px',
|
179
|
+
'overflow' : 'scroll',
|
180
|
+
'visibility' : 'hidden'
|
181
|
+
}).appendTo( 'body' ),
|
182
|
+
div = $div[0],
|
183
|
+
barWidth = div.offsetWidth - div.clientWidth;
|
184
|
+
$div.remove();
|
185
|
+
return barWidth;
|
186
|
+
},
|
187
|
+
|
188
|
+
setup : function( c, wo ) {
|
189
|
+
var maxHt, tbHt, $hdr, $t, $hCells, $fCells, $tableWrap, events, tmp, detectedWidth,
|
190
|
+
$win = $( window ),
|
191
|
+
tsScroller = ts.scroller,
|
192
|
+
namespace = c.namespace + 'tsscroller',
|
193
|
+
$foot = $(),
|
194
|
+
// c.namespace contains a unique tablesorter ID, per table
|
195
|
+
id = c.namespace.slice( 1 ) + 'tsscroller',
|
196
|
+
$table = c.$table;
|
197
|
+
|
198
|
+
// force config.widthFixed option - this helps maintain proper alignment across cloned tables
|
199
|
+
c.widthFixed = true;
|
200
|
+
|
201
|
+
wo.scroller_calcWidths = [];
|
202
|
+
wo.scroller_saved = [ 0, 0 ];
|
203
|
+
wo.scroller_isBusy = true;
|
204
|
+
|
205
|
+
// set scrollbar width to one of the following (1) explicitly set scroller_barWidth option,
|
206
|
+
// (2) detected scrollbar width or (3) fallback of 15px
|
207
|
+
if ( wo.scroller_barWidth !== null ) {
|
208
|
+
wo.scroller_barSetWidth = wo.scroller_barWidth;
|
209
|
+
} else {
|
210
|
+
detectedWidth = tsScroller.getBarWidth();
|
211
|
+
wo.scroller_barSetWidth = detectedWidth !== null ? detectedWidth : 15;
|
212
|
+
}
|
213
|
+
|
214
|
+
maxHt = wo.scroller_height || 300;
|
215
|
+
|
216
|
+
$hdr = $( '<table class="' + $table.attr( 'class' ) + '" cellpadding=0 cellspacing=0>' +
|
217
|
+
$table.children( 'thead' )[ 0 ].outerHTML + '</table>' );
|
218
|
+
wo.scroller_$header = $hdr.addClass( c.namespace.slice( 1 ) + '_extra_table' );
|
219
|
+
|
220
|
+
$t = $table.children( 'tfoot' );
|
221
|
+
if ( $t.length ) {
|
222
|
+
$foot = $( '<table class="' + $table.attr( 'class' ) +
|
223
|
+
'" cellpadding=0 cellspacing=0 style="margin-top:0"></table>' )
|
224
|
+
.addClass( c.namespace.slice( 1 ) + '_extra_table' )
|
225
|
+
// maintain any bindings on the tfoot cells
|
226
|
+
.append( $t.clone( true ) )
|
227
|
+
.wrap( '<div class="' + tscss.scrollerFooter + '"/>' );
|
228
|
+
$fCells = $foot.children( 'tfoot' ).eq( 0 ).children( 'tr' ).children();
|
229
|
+
}
|
230
|
+
wo.scroller_$footer = $foot;
|
231
|
+
|
232
|
+
$table
|
233
|
+
.wrap( '<div id="' + id + '" class="' + tscss.scrollerWrap + '" />' )
|
234
|
+
.before( $hdr )
|
235
|
+
// shrink filter row but don't completely hide it because the inputs/selectors may distort the columns
|
236
|
+
.find( '.' + tscss.filterRow )
|
237
|
+
.addClass( tscss.filterRowHide );
|
238
|
+
|
239
|
+
wo.scroller_$container = $table.parent();
|
240
|
+
|
241
|
+
if ( $foot.length ) {
|
242
|
+
// $foot.parent() to include <div> wrapper
|
243
|
+
$table.after( $foot.parent() );
|
244
|
+
}
|
245
|
+
|
246
|
+
$hCells = $hdr
|
247
|
+
.wrap( '<div class="' + tscss.scrollerHeader + '" />' )
|
248
|
+
.find( '.' + tscss.header );
|
249
|
+
|
250
|
+
// use max-height, so the height resizes dynamically while filtering
|
251
|
+
$table.wrap( '<div class="' + tscss.scrollerTable + '" style="max-height:' + maxHt + 'px;" />' );
|
252
|
+
$tableWrap = $table.parent();
|
253
|
+
|
254
|
+
// make scroller header sortable
|
255
|
+
ts.bindEvents( c.table, $hCells );
|
256
|
+
|
257
|
+
// look for filter widget
|
258
|
+
if ( $table.hasClass( 'hasFilters' ) ) {
|
259
|
+
ts.filter.bindSearch( $table, $hdr.find( '.' + tscss.filter ) );
|
260
|
+
}
|
261
|
+
|
262
|
+
$table
|
263
|
+
.find( 'thead' )
|
264
|
+
.addClass( tscss.scrollerHideElement );
|
265
|
+
|
266
|
+
tbHt = $tableWrap.parent().height();
|
267
|
+
|
268
|
+
// The header will always jump into view if scrolling the table body
|
269
|
+
$tableWrap
|
270
|
+
.off( 'scroll' + namespace )
|
271
|
+
.on( 'scroll' + namespace, function() {
|
272
|
+
if ( wo.scroller_jumpToHeader ) {
|
273
|
+
var pos = $win.scrollTop() - $hdr.offset().top;
|
274
|
+
if ( $( this ).scrollTop() !== 0 && pos < tbHt && pos > 0 ) {
|
275
|
+
$win.scrollTop( $hdr.offset().top );
|
276
|
+
}
|
277
|
+
}
|
278
|
+
$hdr
|
279
|
+
.parent()
|
280
|
+
.add( $foot.parent() )
|
281
|
+
.scrollLeft( $( this ).scrollLeft() );
|
282
|
+
});
|
283
|
+
|
284
|
+
// resize/update events - filterEnd fires after "tablesorter-initialized" and "updateComplete"
|
285
|
+
events = ( ( ts.hasWidget( c.table, 'filter' ) ? 'filterEnd' : 'tablesorter-initialized updateComplete' ) +
|
286
|
+
' sortEnd pagerComplete columnUpdate ' ).split( ' ' ).join( namespace + ' ' );
|
287
|
+
|
288
|
+
$table
|
289
|
+
.off( namespace )
|
290
|
+
.on( 'sortEnd filterEnd'.split( ' ' ).join( namespace + ' ' ), function( event ) {
|
291
|
+
// Sorting, so scroll to top
|
292
|
+
if ( event.type === 'sortEnd' && wo.scroller_upAfterSort ) {
|
293
|
+
$tableWrap.animate({
|
294
|
+
scrollTop : 0
|
295
|
+
}, 'fast' );
|
296
|
+
} else if ( wo.scroller_fixedColumns ) {
|
297
|
+
setTimeout( function() {
|
298
|
+
// restore previous scroll position
|
299
|
+
$tableWrap
|
300
|
+
.scrollTop( wo.scroller_saved[1] )
|
301
|
+
.scrollLeft( wo.scroller_saved[0] );
|
302
|
+
tsScroller.updateFixed( c, wo );
|
303
|
+
}, 0 );
|
304
|
+
}
|
305
|
+
})
|
306
|
+
.on( 'setFixedColumnSize' + namespace, function( event, size ) {
|
307
|
+
var $wrap = wo.scroller_$container;
|
308
|
+
if ( typeof size !== 'undefined' && !isNaN( size ) ) {
|
309
|
+
wo.scroller_fixedColumns = parseInt( size, 10 );
|
310
|
+
}
|
311
|
+
// remove fixed columns
|
312
|
+
tsScroller.removeFixed( c, wo );
|
313
|
+
size = wo.scroller_fixedColumns;
|
314
|
+
if ( size > 0 && size < c.columns - 1 ) {
|
315
|
+
tsScroller.updateFixed( c, wo );
|
316
|
+
} else if ( $wrap.hasClass( tscss.scrollerHasFix ) ) {
|
317
|
+
$wrap.removeClass( tscss.scrollerHasFix );
|
318
|
+
// resize needed to make tables full width
|
319
|
+
tsScroller.resize( c, wo );
|
320
|
+
}
|
321
|
+
})
|
322
|
+
.on( events, function( event ) {
|
323
|
+
// Stop from running twice with pager
|
324
|
+
if ( ts.hasWidget( 'pager' ) && event.type === 'updateComplete' ) {
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
if ( wo.scroller_fixedColumns > 0 ) {
|
328
|
+
tsScroller.updateFixed( c, wo );
|
329
|
+
}
|
330
|
+
// adjust column sizes after an update
|
331
|
+
tsScroller.resize( c, wo );
|
332
|
+
});
|
333
|
+
|
334
|
+
// Setup window.resizeEnd event
|
335
|
+
$win
|
336
|
+
.off( 'resize resizeEnd '.split( ' ' ).join( namespace + ' ' ) )
|
337
|
+
.on( 'resize' + namespace, ts.window_resize )
|
338
|
+
.on( 'resizeEnd' + namespace, function() {
|
339
|
+
// IE calls resize when you modify content, so we have to unbind the resize event
|
340
|
+
// so we don't end up with an infinite loop. we can rebind after we're done.
|
341
|
+
$win.off( 'resize' + namespace, ts.window_resize );
|
342
|
+
tsScroller.resize( c, wo );
|
343
|
+
$win.on( 'resize' + namespace, ts.window_resize );
|
344
|
+
$tableWrap.trigger( 'scroll' + namespace );
|
345
|
+
});
|
346
|
+
|
347
|
+
// initialization flag
|
348
|
+
c.isScrolling = true;
|
349
|
+
|
350
|
+
tsScroller.updateFixed( c, wo );
|
351
|
+
|
352
|
+
// updateAll called - need to give the browser time to adjust the layout
|
353
|
+
// before calculating fix column widths
|
354
|
+
if ( c.table.hasInitialized && c.isScrolling ) {
|
355
|
+
setTimeout(function(){
|
356
|
+
ts.scroller.resize( c, wo );
|
357
|
+
}, 50);
|
358
|
+
}
|
359
|
+
|
360
|
+
},
|
361
|
+
|
362
|
+
resize : function( c, wo ) {
|
363
|
+
if ( wo.scroller_isBusy ) { return; }
|
364
|
+
var index, borderWidth, setWidth, $hCells, $bCells, $fCells, $headers, $this, temp,
|
365
|
+
tsScroller = ts.scroller,
|
366
|
+
$container = wo.scroller_$container,
|
367
|
+
$table = c.$table,
|
368
|
+
$tableWrap = $table.parent(),
|
369
|
+
$hdr = wo.scroller_$header,
|
370
|
+
$foot = wo.scroller_$footer,
|
371
|
+
id = c.namespace.slice( 1 ) + 'tsscroller',
|
372
|
+
// Hide other scrollers so we can resize
|
373
|
+
$div = $( 'div.' + tscss.scrollerWrap + '[id!="' + id + '"]' )
|
374
|
+
.addClass( tscss.scrollerHideElement ),
|
375
|
+
row = '<tr class="' + tscss.scrollerSpacerRow + ' ' + c.selectorRemove.slice(1) + '">';
|
376
|
+
|
377
|
+
wo.scroller_calcWidths = [];
|
378
|
+
|
379
|
+
// Remove fixed so we get proper widths and heights
|
380
|
+
tsScroller.removeFixed( c, wo );
|
381
|
+
$container.find( '.' + tscss.scrollerSpacerRow ).remove();
|
382
|
+
// remove ts added colgroups
|
383
|
+
$container.find( '.' + ts.css.colgroup ).remove();
|
384
|
+
|
385
|
+
// show original table elements to get proper alignment
|
386
|
+
$table
|
387
|
+
.find( '.' + tscss.scrollerHideElement )
|
388
|
+
.removeClass( tscss.scrollerHideElement );
|
389
|
+
|
390
|
+
// include left & right border widths
|
391
|
+
borderWidth = parseInt( $table.css( 'border-left-width' ), 10 );
|
392
|
+
|
393
|
+
$headers = c.$headerIndexed;
|
394
|
+
|
395
|
+
for ( index = 0; index < c.columns; index++ ) {
|
396
|
+
$this = $headers[ index ];
|
397
|
+
// code from https://github.com/jmosbech/StickyTableHeaders
|
398
|
+
if ( $this.css( 'box-sizing' ) === 'border-box' ) {
|
399
|
+
setWidth = $this.outerWidth();
|
400
|
+
} else {
|
401
|
+
if ( $this.css( 'border-collapse' ) === 'collapse' ) {
|
402
|
+
if ( $this.length && window.getComputedStyle ) {
|
403
|
+
setWidth = parseFloat( window.getComputedStyle( $this[ 0 ], null ).width );
|
404
|
+
} else {
|
405
|
+
// ie8 only
|
406
|
+
setWidth = $this.outerWidth() - parseFloat( $this.css( 'padding-left' ) ) -
|
407
|
+
parseFloat( $this.css( 'padding-right' ) ) -
|
408
|
+
( parseFloat( $this.css( 'border-width' ) ) || 0 );
|
409
|
+
}
|
410
|
+
} else {
|
411
|
+
setWidth = $this.width();
|
412
|
+
}
|
413
|
+
}
|
414
|
+
row += '<td data-column="' + index + '" style="padding:0;margin:0;border:0;height:0;max-height:0;' +
|
415
|
+
'min-height:0;width:' + setWidth + 'px;min-width:' + setWidth + 'px;max-width:' + setWidth + 'px"></td>';
|
416
|
+
|
417
|
+
// save current widths
|
418
|
+
wo.scroller_calcWidths[ index ] = setWidth;
|
419
|
+
}
|
420
|
+
row += '</tr>';
|
421
|
+
c.$tbodies.eq(0).prepend( row ); // tbody
|
422
|
+
$hdr.children( 'thead' ).append( row );
|
423
|
+
$foot.children( 'tfoot' ).append( row );
|
424
|
+
|
425
|
+
// include colgroup or alignment is off
|
426
|
+
ts.fixColumnWidth( c.table );
|
427
|
+
row = c.$table.children( 'colgroup' )[0].outerHTML;
|
428
|
+
$hdr.prepend( row );
|
429
|
+
$foot.prepend( row );
|
430
|
+
|
431
|
+
temp = $tableWrap.parent().innerWidth() -
|
432
|
+
( tsScroller.hasScrollBar( $tableWrap ) ? wo.scroller_barSetWidth : 0 );
|
433
|
+
$tableWrap.width( temp );
|
434
|
+
|
435
|
+
temp = ( tsScroller.hasScrollBar( $tableWrap ) ? wo.scroller_barSetWidth : 0 ) + borderWidth;
|
436
|
+
setWidth = $tableWrap.innerWidth() - temp;
|
437
|
+
|
438
|
+
$hdr
|
439
|
+
.parent()
|
440
|
+
.add( $foot.parent() )
|
441
|
+
.width( setWidth );
|
442
|
+
|
443
|
+
$tableWrap
|
444
|
+
.width( setWidth + temp );
|
445
|
+
|
446
|
+
// hide original table thead
|
447
|
+
$table.children( 'thead' ).addClass( tscss.scrollerHideElement );
|
448
|
+
|
449
|
+
// update fixed column sizes
|
450
|
+
tsScroller.updateFixed( c, wo );
|
451
|
+
|
452
|
+
$div.removeClass( tscss.scrollerHideElement );
|
453
|
+
|
454
|
+
// restore scrollTop - fixes #926
|
455
|
+
$tableWrap.scrollTop( wo.scroller_saved[1] );
|
456
|
+
wo.scroller_$container
|
457
|
+
.find( '.' + tscss.scrollerFixed )
|
458
|
+
.find( '.' + tscss.scrollerTable )
|
459
|
+
.scrollTop( wo.scroller_saved[1] );
|
460
|
+
|
461
|
+
// update resizable widget handles
|
462
|
+
setTimeout( function() {
|
463
|
+
c.$table.triggerHandler( 'resizableUpdate' );
|
464
|
+
}, 100 );
|
465
|
+
|
466
|
+
},
|
467
|
+
|
468
|
+
// Add fixed (frozen) columns (Do not call directly, use updateFixed)
|
469
|
+
setupFixed : function( c, wo ) {
|
470
|
+
var index, index2, $el, len, temp, $fixedColumn, $fixedTbody,
|
471
|
+
$table = c.$table,
|
472
|
+
$wrapper = wo.scroller_$container,
|
473
|
+
fixedColumns = wo.scroller_fixedColumns;
|
474
|
+
|
475
|
+
$fixedColumn = $wrapper
|
476
|
+
.addClass( tscss.scrollerHasFix )
|
477
|
+
.clone()
|
478
|
+
.addClass( tscss.scrollerFixed )
|
479
|
+
.removeClass( tscss.scrollerWrap )
|
480
|
+
.attr( 'id', '' );
|
481
|
+
|
482
|
+
if ( wo.scroller_addFixedOverlay ) {
|
483
|
+
$fixedColumn.append( '<div class="' + tscss.scrollerFixedPanel + '">' );
|
484
|
+
}
|
485
|
+
|
486
|
+
$fixedTbody = $fixedColumn.find( '.' + tscss.scrollerTable );
|
487
|
+
$fixedTbody
|
488
|
+
.children( 'table' )
|
489
|
+
.addClass( c.namespace.slice( 1 ) + '_extra_table' )
|
490
|
+
.attr( 'id', '' )
|
491
|
+
.children( 'thead, tfoot' )
|
492
|
+
.remove();
|
493
|
+
|
494
|
+
wo.scroller_$fixedColumns = $fixedColumn;
|
495
|
+
|
496
|
+
// RTL support (fixes column on right)
|
497
|
+
if ( $table.hasClass( tscss.scrollerRtl ) ) {
|
498
|
+
$fixedColumn.addClass( tscss.scrollerRtl );
|
499
|
+
}
|
500
|
+
|
501
|
+
$el = $fixedColumn.find( 'tr' );
|
502
|
+
len = $el.length;
|
503
|
+
for ( index = 0; index < len; index++ ) {
|
504
|
+
$el.eq( index ).children( ':gt(' + ( fixedColumns - 1 ) + ')' ).remove();
|
505
|
+
}
|
506
|
+
$fixedColumn
|
507
|
+
.addClass( tscss.scrollerHideElement )
|
508
|
+
.prependTo( $wrapper );
|
509
|
+
|
510
|
+
// look for filter widget
|
511
|
+
if ( c.$table.hasClass( 'hasFilters' ) ) {
|
512
|
+
// make sure fixed column filters aren't disabled
|
513
|
+
$el = $fixedColumn
|
514
|
+
.find( '.' + tscss.filter )
|
515
|
+
.not( '.' + tscss.filterDisabled )
|
516
|
+
.prop( 'disabled', false );
|
517
|
+
ts.filter.bindSearch( $table, $fixedColumn.find( '.' + tscss.filter ) );
|
518
|
+
// disable/enable filters behind fixed column
|
519
|
+
$el = $wrapper
|
520
|
+
.children( '.' + tscss.scrollerHeader )
|
521
|
+
.find( '.' + tscss.filter );
|
522
|
+
len = $el.length;
|
523
|
+
for ( index = 0; index < len; index++ ) {
|
524
|
+
// previously disabled filter; don't mess with it! filterDisabled class added by filter widget
|
525
|
+
if ( !$el.eq( index ).hasClass( tscss.filterDisabled || 'disabled' ) ) {
|
526
|
+
// disable filters behind fixed column; don't disable visible filters
|
527
|
+
$el.eq( index ).prop( 'disabled', index < fixedColumns );
|
528
|
+
}
|
529
|
+
}
|
530
|
+
}
|
531
|
+
|
532
|
+
// disable/enable tab indexes behind fixed column
|
533
|
+
c.$table
|
534
|
+
.add( '.' + tscss.scrollerFooter + ' table' )
|
535
|
+
.children( 'thead' )
|
536
|
+
.children( 'tr.' + tscss.headerRow )
|
537
|
+
.children()
|
538
|
+
.attr( 'tabindex', -1 );
|
539
|
+
|
540
|
+
$el = wo.scroller_$header
|
541
|
+
.add( $fixedColumn.find( '.' + tscss.scrollerTable + ' table' ) )
|
542
|
+
.children( 'thead' )
|
543
|
+
.children( 'tr.' + tscss.headerRow );
|
544
|
+
len = $el.length;
|
545
|
+
for ( index = 0; index < len; index++ ) {
|
546
|
+
temp = $el.eq( index ).children();
|
547
|
+
for ( index2 = 0; index2 < temp.length; index2++ ) {
|
548
|
+
temp.eq( index2 ).attr( 'tabindex', index2 < fixedColumns ? -1 : 0 );
|
549
|
+
}
|
550
|
+
}
|
551
|
+
|
552
|
+
ts.bindEvents( c.table, $fixedColumn.find( '.' + tscss.header ) );
|
553
|
+
ts.scroller.bindFixedColumnEvents( c, wo );
|
554
|
+
|
555
|
+
/*** Scrollbar hack! Since we can't hide the scrollbar with css ***/
|
556
|
+
if ( ts.scroller.isFirefox || ts.scroller.isOldIE ) {
|
557
|
+
$fixedTbody.wrap( '<div class="' + tscss.scrollerHack + '" style="overflow:hidden;">' );
|
558
|
+
}
|
559
|
+
|
560
|
+
},
|
561
|
+
|
562
|
+
bindFixedColumnEvents : function( c, wo ) {
|
563
|
+
// update thead & tbody in fixed column
|
564
|
+
var tsScroller = ts.scroller,
|
565
|
+
namespace = c.namespace + 'tsscrollerFixed',
|
566
|
+
events = 'scroll' + namespace,
|
567
|
+
$fixedTbody = wo.scroller_$fixedColumns.find( '.' + tscss.scrollerTable ),
|
568
|
+
fixedScroll = true,
|
569
|
+
tableScroll = true;
|
570
|
+
|
571
|
+
c.$table
|
572
|
+
.parent()
|
573
|
+
// *** SCROLL *** scroll fixed column along with main
|
574
|
+
.off( events )
|
575
|
+
.on( events, function() {
|
576
|
+
if ( wo.scroller_isBusy ) { return; }
|
577
|
+
// using flags to prevent firing the scroll event excessively leading to slow scrolling in Firefox
|
578
|
+
if ( !wo.scroller_isBusy && ( fixedScroll || !( tsScroller.isFirefox || tsScroller.isIE ) ) ) {
|
579
|
+
tableScroll = false;
|
580
|
+
var $this = $( this );
|
581
|
+
$fixedTbody[0].scrollTop = wo.scroller_saved[1] = $this.scrollTop();
|
582
|
+
wo.scroller_saved[0] = $this.scrollLeft();
|
583
|
+
setTimeout( function() {
|
584
|
+
tableScroll = true;
|
585
|
+
}, 20 );
|
586
|
+
}
|
587
|
+
});
|
588
|
+
// scroll main along with fixed column
|
589
|
+
$fixedTbody
|
590
|
+
.off( events )
|
591
|
+
.on( events, function() {
|
592
|
+
// using flags to prevent firing the scroll event excessively leading to slow scrolling in Firefox
|
593
|
+
if ( !wo.scroller_isBusy && ( tableScroll || !( tsScroller.isFirefox || tsScroller.isIE ) ) ) {
|
594
|
+
fixedScroll = false;
|
595
|
+
var $this = $( this );
|
596
|
+
c.$table.parent()[0].scrollTop = wo.scroller_saved[1] = $this.scrollTop();
|
597
|
+
setTimeout( function() {
|
598
|
+
fixedScroll = true;
|
599
|
+
}, 20 );
|
600
|
+
}
|
601
|
+
})
|
602
|
+
.scroll();
|
603
|
+
|
604
|
+
// *** ROW HIGHLIGHT ***
|
605
|
+
if ( wo.scroller_rowHighlight !== '' ) {
|
606
|
+
events = 'mouseover mouseleave '.split( ' ' ).join( namespace + ' ' );
|
607
|
+
// can't use c.$tbodies because it doesn't include info-only tbodies
|
608
|
+
c.$table
|
609
|
+
.off( events, 'tbody > tr' )
|
610
|
+
.on( events, 'tbody > tr', function( event ) {
|
611
|
+
var indx = c.$table.children( 'tbody' ).children( 'tr' ).index( this );
|
612
|
+
$fixedTbody
|
613
|
+
.children( 'table' )
|
614
|
+
.children( 'tbody' )
|
615
|
+
.children( 'tr' )
|
616
|
+
.eq( indx )
|
617
|
+
.add( this )
|
618
|
+
.toggleClass( wo.scroller_rowHighlight, event.type === 'mouseover' );
|
619
|
+
});
|
620
|
+
$fixedTbody
|
621
|
+
.find( 'table' )
|
622
|
+
.off( events, 'tbody > tr' )
|
623
|
+
.on( events, 'tbody > tr', function( event ) {
|
624
|
+
var $fixed = $fixedTbody.children( 'table' ).children( 'tbody' ).children( 'tr' ),
|
625
|
+
indx = $fixed.index( this );
|
626
|
+
c.$table
|
627
|
+
.children( 'tbody' )
|
628
|
+
.children( 'tr' )
|
629
|
+
.eq( indx )
|
630
|
+
.add( this )
|
631
|
+
.toggleClass( wo.scroller_rowHighlight, event.type === 'mouseover' );
|
632
|
+
});
|
633
|
+
}
|
634
|
+
},
|
635
|
+
|
636
|
+
adjustWidth : function( c, wo, totalWidth, adj, dir ) {
|
637
|
+
var $wrapper = wo.scroller_$container;
|
638
|
+
|
639
|
+
// RTL support (fixes column on right)
|
640
|
+
$wrapper
|
641
|
+
.children( '.' + tscss.scrollerTable )
|
642
|
+
.css( dir ? 'right' : 'left', totalWidth );
|
643
|
+
$wrapper
|
644
|
+
.children( '.' + tscss.scrollerHeader + ', .' + tscss.scrollerFooter )
|
645
|
+
// Safari needs a scrollbar width of extra adjusment to align the fixed & scrolling columns
|
646
|
+
.css( dir ? 'right' : 'left', totalWidth + ( dir && ts.scroller.isSafari ? adj : 0 ) );
|
647
|
+
},
|
648
|
+
|
649
|
+
updateFixed : function( c, wo ) {
|
650
|
+
var temp, adj,
|
651
|
+
$wrapper = wo.scroller_$container,
|
652
|
+
$hdr = wo.scroller_$header,
|
653
|
+
$foot = wo.scroller_$footer,
|
654
|
+
$table = c.$table,
|
655
|
+
$tableWrap = $table.parent(),
|
656
|
+
scrollBarWidth = wo.scroller_barSetWidth,
|
657
|
+
dir = $table.hasClass( tscss.scrollerRtl );
|
658
|
+
|
659
|
+
if ( wo.scroller_fixedColumns === 0 ) {
|
660
|
+
wo.scroller_isBusy = false;
|
661
|
+
ts.scroller.removeFixed( c, wo );
|
662
|
+
temp = $wrapper.width();
|
663
|
+
$tableWrap.width( temp );
|
664
|
+
adj = ts.scroller.hasScrollBar( $tableWrap ) ? scrollBarWidth : 0;
|
665
|
+
$hdr
|
666
|
+
.parent()
|
667
|
+
.add( $foot.parent() )
|
668
|
+
.width( temp - adj );
|
669
|
+
return;
|
670
|
+
}
|
671
|
+
|
672
|
+
if ( !c.isScrolling ) {
|
673
|
+
return;
|
674
|
+
}
|
675
|
+
|
676
|
+
wo.scroller_isBusy = true;
|
677
|
+
|
678
|
+
// Make sure the wo.scroller_$fixedColumns container exists, if not build it
|
679
|
+
if ( !$wrapper.find( '.' + tscss.scrollerFixed ).length ) {
|
680
|
+
ts.scroller.setupFixed( c, wo );
|
681
|
+
}
|
682
|
+
|
683
|
+
// scroller_fixedColumns
|
684
|
+
var index, tbodyIndex, rowIndex, $tbody, $adjCol, $fb, $fixHead, $fixBody, $fixFoot,
|
685
|
+
totalRows, row,
|
686
|
+
|
687
|
+
// source cells for measurement
|
688
|
+
$mainTbodies = wo.scroller_$container
|
689
|
+
.children( '.' + tscss.scrollerTable )
|
690
|
+
.children( 'table' )
|
691
|
+
.children( 'tbody' ),
|
692
|
+
// variable gets redefined
|
693
|
+
$rows = wo.scroller_$header
|
694
|
+
.children( 'thead' )
|
695
|
+
.children( '.' + tscss.headerRow ),
|
696
|
+
|
697
|
+
// hide fixed column during resize, or we get a FOUC
|
698
|
+
$fixedColumn = wo.scroller_$fixedColumns
|
699
|
+
.addClass( tscss.scrollerHideElement ),
|
700
|
+
|
701
|
+
// target cells
|
702
|
+
$fixedTbodiesTable = $fixedColumn
|
703
|
+
.find( '.' + tscss.scrollerTable )
|
704
|
+
.children( 'table' ),
|
705
|
+
$fixedTbodies = $fixedTbodiesTable
|
706
|
+
.children( 'tbody' ),
|
707
|
+
// variables
|
708
|
+
tsScroller = ts.scroller,
|
709
|
+
fixedColumns = wo.scroller_fixedColumns,
|
710
|
+
// get dimensions
|
711
|
+
$temp = $table.find( 'tbody td' ),
|
712
|
+
borderRightWidth = parseInt( $temp.css( 'border-right-width' ), 10 ) || 1,
|
713
|
+
borderSpacing = parseInt( ( $temp.css( 'border-spacing' ) || '' ).split( /\s/ )[ 0 ], 10 ) / 2 || 0,
|
714
|
+
totalWidth = parseInt( $table.css( 'padding-left' ), 10 ) +
|
715
|
+
parseInt( $table.css( 'padding-right' ), 10 ) -
|
716
|
+
borderRightWidth,
|
717
|
+
widths = wo.scroller_calcWidths;
|
718
|
+
|
719
|
+
ts.scroller.removeFixed( c, wo, false );
|
720
|
+
|
721
|
+
// calculate fixed column width
|
722
|
+
for ( index = 0; index < fixedColumns; index++ ) {
|
723
|
+
totalWidth += widths[ index ] + borderSpacing;
|
724
|
+
}
|
725
|
+
|
726
|
+
// set fixed column width
|
727
|
+
totalWidth = totalWidth + borderRightWidth * 2 - borderSpacing;
|
728
|
+
tsScroller.setWidth( $fixedColumn.add( $fixedColumn.children() ), totalWidth );
|
729
|
+
tsScroller.setWidth( $fixedColumn.children().children( 'table' ), totalWidth );
|
730
|
+
|
731
|
+
// update fixed column tbody content, set cell widths on hidden row
|
732
|
+
for ( tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++ ) {
|
733
|
+
$tbody = $mainTbodies.eq( tbodyIndex );
|
734
|
+
if ( $tbody.length ) {
|
735
|
+
// get tbody
|
736
|
+
$rows = $tbody.children();
|
737
|
+
totalRows = $rows.length;
|
738
|
+
$fb = ts.processTbody( $fixedTbodiesTable, $fixedTbodies.eq( tbodyIndex ), true );
|
739
|
+
$fb.empty();
|
740
|
+
// update tbody cells after sort/filtering
|
741
|
+
for ( rowIndex = 0; rowIndex < totalRows; rowIndex++ ) {
|
742
|
+
$adjCol = $( $rows[ rowIndex ].outerHTML );
|
743
|
+
$adjCol
|
744
|
+
.children( 'td, th' )
|
745
|
+
.slice( fixedColumns )
|
746
|
+
.remove();
|
747
|
+
$fb.append( $adjCol );
|
748
|
+
}
|
749
|
+
|
750
|
+
// restore tbody
|
751
|
+
ts.processTbody( $fixedTbodiesTable, $fb, false );
|
752
|
+
}
|
753
|
+
}
|
754
|
+
|
755
|
+
adj = ts.scroller.hasScrollBar( $tableWrap ) ? scrollBarWidth : 0;
|
756
|
+
|
757
|
+
/*** scrollbar HACK! Since we can't hide the scrollbar with css ***/
|
758
|
+
if ( tsScroller.isFirefox || tsScroller.isOldIE ) {
|
759
|
+
$fixedTbodiesTable
|
760
|
+
.css( 'width', totalWidth )
|
761
|
+
.parent()
|
762
|
+
.css( 'width', totalWidth + adj );
|
763
|
+
}
|
764
|
+
|
765
|
+
$fixedColumn.removeClass( tscss.scrollerHideElement );
|
766
|
+
for ( index = 0; index < fixedColumns; index++ ) {
|
767
|
+
$wrapper
|
768
|
+
.children( 'div' )
|
769
|
+
.children( 'table' )
|
770
|
+
.find( 'th:nth-child(' + ( index + 1 ) + '), td:nth-child(' + ( index + 1 ) + ')' )
|
771
|
+
.addClass( tscss.scrollerHideColumn );
|
772
|
+
}
|
773
|
+
|
774
|
+
totalWidth = totalWidth - borderRightWidth;
|
775
|
+
temp = $tableWrap.parent().innerWidth() - totalWidth;
|
776
|
+
$tableWrap.width( temp );
|
777
|
+
// RTL support (fixes column on right)
|
778
|
+
$wrapper
|
779
|
+
.children( '.' + tscss.scrollerTable )
|
780
|
+
.css( dir ? 'right' : 'left', totalWidth );
|
781
|
+
$wrapper
|
782
|
+
.children( '.' + tscss.scrollerHeader + ', .' + tscss.scrollerFooter )
|
783
|
+
// Safari needs a scrollbar width of extra adjusment to align the fixed & scrolling columns
|
784
|
+
.css( dir ? 'right' : 'left', totalWidth + ( dir && ts.scroller.isSafari ? adj : 0 ) );
|
785
|
+
|
786
|
+
$hdr
|
787
|
+
.parent()
|
788
|
+
.add( $foot.parent() )
|
789
|
+
.width( temp - adj );
|
790
|
+
|
791
|
+
// fix gap under the tbody for the horizontal scrollbar
|
792
|
+
temp = ts.scroller.hasScrollBar( $tableWrap, true );
|
793
|
+
adj = temp ? scrollBarWidth : 0;
|
794
|
+
if ( !$fixedColumn.find( '.' + tscss.scrollerBarSpacer ).length && temp ) {
|
795
|
+
$temp = $( '<div class="' + tscss.scrollerBarSpacer + '">' )
|
796
|
+
.css( 'height', adj + 'px' );
|
797
|
+
$fixedColumn.find( '.' + tscss.scrollerTable ).append( $temp );
|
798
|
+
} else if ( !temp ) {
|
799
|
+
$fixedColumn.find( '.' + tscss.scrollerBarSpacer ).remove();
|
800
|
+
}
|
801
|
+
|
802
|
+
ts.scroller.updateRowHeight( c, wo );
|
803
|
+
// set fixed column height (changes with filtering)
|
804
|
+
$fixedColumn.height( $wrapper.height() );
|
805
|
+
|
806
|
+
$fixedColumn.removeClass( tscss.scrollerHideElement );
|
807
|
+
|
808
|
+
wo.scroller_isBusy = false;
|
809
|
+
|
810
|
+
},
|
811
|
+
|
812
|
+
fixHeight : function( $rows, $fixedRows ) {
|
813
|
+
var index, heightRow, heightFixed, $r, $f,
|
814
|
+
addedHt = tscss.scrollerAddedHeight,
|
815
|
+
len = $rows.length;
|
816
|
+
for ( index = 0; index < len; index++ ) {
|
817
|
+
$r = $rows.eq( index );
|
818
|
+
$f = $fixedRows.eq( index );
|
819
|
+
heightRow = $r.height();
|
820
|
+
heightFixed = $f.height();
|
821
|
+
if ( heightRow > heightFixed ) {
|
822
|
+
$f.addClass( addedHt ).height( heightRow );
|
823
|
+
} else if ( heightRow < heightFixed ) {
|
824
|
+
$r.addClass( addedHt ).height( heightFixed );
|
825
|
+
}
|
826
|
+
}
|
827
|
+
},
|
828
|
+
|
829
|
+
updateRowHeight : function( c, wo ) {
|
830
|
+
var $rows, $fixed,
|
831
|
+
$fixedColumns = wo.scroller_$fixedColumns;
|
832
|
+
|
833
|
+
wo.scroller_$container
|
834
|
+
.find( '.' + tscss.scrollerAddedHeight )
|
835
|
+
.removeClass( tscss.scrollerAddedHeight )
|
836
|
+
.height( '' );
|
837
|
+
|
838
|
+
$rows = wo.scroller_$header
|
839
|
+
.children( 'thead' )
|
840
|
+
.children( 'tr' );
|
841
|
+
$fixed = $fixedColumns
|
842
|
+
.children( '.' + tscss.scrollerHeader )
|
843
|
+
.children( 'table' )
|
844
|
+
.children( 'thead' )
|
845
|
+
.children( 'tr' );
|
846
|
+
ts.scroller.fixHeight( $rows, $fixed );
|
847
|
+
|
848
|
+
$rows = wo.scroller_$footer
|
849
|
+
.children( 'tfoot' )
|
850
|
+
.children( 'tr' );
|
851
|
+
$fixed = $fixedColumns
|
852
|
+
.children( '.' + tscss.scrollerFooter )
|
853
|
+
.children( 'table' )
|
854
|
+
.children( 'tfoot' )
|
855
|
+
.children( 'tr' );
|
856
|
+
ts.scroller.fixHeight( $rows, $fixed );
|
857
|
+
|
858
|
+
if ( ts.scroller.isFirefox || ts.scroller.isOldIE ) {
|
859
|
+
// Firefox/Old IE scrollbar hack (wraps table to hide the scrollbar)
|
860
|
+
$fixedColumns = $fixedColumns.find( '.' + tscss.scrollerHack );
|
861
|
+
}
|
862
|
+
$rows = c.$table
|
863
|
+
.children( 'tbody' )
|
864
|
+
.children( 'tr' );
|
865
|
+
$fixed = $fixedColumns
|
866
|
+
.children( '.' + tscss.scrollerTable )
|
867
|
+
.children( 'table' )
|
868
|
+
.children( 'tbody' )
|
869
|
+
.children( 'tr' );
|
870
|
+
ts.scroller.fixHeight( $rows, $fixed );
|
871
|
+
|
872
|
+
},
|
873
|
+
|
874
|
+
removeFixed : function( c, wo, removeIt ) {
|
875
|
+
var $table = c.$table,
|
876
|
+
$wrapper = wo.scroller_$container,
|
877
|
+
dir = $table.hasClass( tscss.scrollerRtl );
|
878
|
+
|
879
|
+
// remove fixed columns
|
880
|
+
if ( removeIt || typeof removeIt === 'undefined' ) {
|
881
|
+
$wrapper.find( '.' + tscss.scrollerFixed ).remove();
|
882
|
+
}
|
883
|
+
|
884
|
+
$wrapper
|
885
|
+
.find( '.' + tscss.scrollerHideColumn )
|
886
|
+
.removeClass( tscss.scrollerHideColumn );
|
887
|
+
|
888
|
+
// RTL support ( fixes column on right )
|
889
|
+
$wrapper
|
890
|
+
.children( ':not(.' + tscss.scrollerFixed + ')' )
|
891
|
+
.css( dir ? 'right' : 'left', 0 );
|
892
|
+
},
|
893
|
+
|
894
|
+
remove : function( c, wo ) {
|
895
|
+
var $wrap = wo.scroller_$container,
|
896
|
+
namespace = c.namespace + 'tsscroller';
|
897
|
+
c.$table.off( namespace );
|
898
|
+
$( window ).off( namespace );
|
899
|
+
if ( $wrap ) {
|
900
|
+
c.$table
|
901
|
+
.insertBefore( $wrap )
|
902
|
+
.find( 'thead' )
|
903
|
+
.removeClass( tscss.scrollerHideElement )
|
904
|
+
.children( 'tr.' + tscss.headerRow )
|
905
|
+
.children()
|
906
|
+
.attr( 'tabindex', 0 )
|
907
|
+
.end()
|
908
|
+
.find( '.' + tscss.filterRow )
|
909
|
+
.removeClass( tscss.scrollerHideElement + ' ' + tscss.filterRowHide );
|
910
|
+
c.$table
|
911
|
+
.find( '.' + tscss.filter )
|
912
|
+
.not( '.' + tscss.filterDisabled )
|
913
|
+
.prop( 'disabled', false );
|
914
|
+
$wrap.remove();
|
915
|
+
c.isScrolling = false;
|
916
|
+
}
|
917
|
+
}
|
918
|
+
|
919
|
+
};
|
920
|
+
|
921
|
+
})( jQuery, window );
|