jquery-tablesorter 1.17.2 → 1.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +76 -71
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.dragtable.mod.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +2647 -2576
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +174 -119
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +2487 -2471
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-extract.js +15 -15
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-range.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +12 -12
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-duration.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +6 -6
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +22 -22
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +15 -15
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-image.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +10 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-named-numbers.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-network.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-roman.js +4 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +122 -121
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +13 -13
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-chart.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +324 -324
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columns.js +60 -60
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +219 -219
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-html5.js +360 -361
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-jui.js +666 -666
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-select2.js +124 -124
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-type-insideRange.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +1448 -1433
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-formatter.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +213 -213
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +271 -216
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +339 -320
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +1057 -1045
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-print.js +109 -109
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-reflow.js +114 -115
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-resizable.js +360 -359
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-saveSort.js +59 -59
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +818 -806
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sort2Hash.js +128 -0
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sortTbodies.js +195 -195
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-staticRow.js +90 -90
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +257 -257
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-storage.js +76 -76
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-uitheme.js +170 -170
- metadata +3 -3
- data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +0 -195
@@ -2,10 +2,10 @@
|
|
2
2
|
/* alt attribute parser for jQuery 1.7+ & tablesorter 2.7.11+ */
|
3
3
|
/*jshint jquery:true, unused:false */
|
4
4
|
;(function($){
|
5
|
-
|
5
|
+
'use strict';
|
6
6
|
|
7
7
|
$.tablesorter.addParser({
|
8
|
-
id:
|
8
|
+
id: 'image',
|
9
9
|
is: function(){
|
10
10
|
return false;
|
11
11
|
},
|
@@ -13,7 +13,7 @@
|
|
13
13
|
return $(cell).find('img').attr(table.config.imgAttr || 'alt') || s;
|
14
14
|
},
|
15
15
|
parsed : true, // filter widget flag
|
16
|
-
type:
|
16
|
+
type: 'text'
|
17
17
|
});
|
18
18
|
|
19
19
|
})(jQuery);
|
@@ -1,10 +1,10 @@
|
|
1
|
-
/*! Parser: input & select - updated
|
1
|
+
/*! Parser: input & select - updated 7/28/2015 (v2.22.4) *//*
|
2
2
|
* for jQuery 1.7+ & tablesorter 2.7.11+
|
3
3
|
* Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
|
4
4
|
*/
|
5
5
|
/*jshint browser: true, jquery:true, unused:false */
|
6
6
|
;( function( $ ) {
|
7
|
-
'use strict';
|
7
|
+
'use strict';
|
8
8
|
|
9
9
|
var updateServer = function( event, $table, $input ) {
|
10
10
|
// do something here to update your server, if needed
|
@@ -53,6 +53,7 @@
|
|
53
53
|
},
|
54
54
|
format : function( txt, table, cell, cellIndex ) {
|
55
55
|
var $cell = $( cell ),
|
56
|
+
$row = $cell.closest( 'tr' ),
|
56
57
|
wo = table.config.widgetOptions,
|
57
58
|
checkedClass = table.config.checkboxClass || 'checked',
|
58
59
|
// returning plain language here because this is what is shown in the
|
@@ -62,7 +63,13 @@
|
|
62
63
|
isChecked = $input.length ? $input[ 0 ].checked : '';
|
63
64
|
// adding class to row, indicating that a checkbox is checked; includes
|
64
65
|
// a column index in case more than one checkbox happens to be in a row
|
65
|
-
$
|
66
|
+
$row.toggleClass( checkedClass + '-' + cellIndex, isChecked );
|
67
|
+
if ( isChecked ) {
|
68
|
+
$row.addClass( checkedClass );
|
69
|
+
} else if ( !( $row[0].className || '' ).match( checkedClass + '-' ) ) {
|
70
|
+
// don't remove checked class if other columns have a check
|
71
|
+
$row.removeClass( checkedClass );
|
72
|
+
}
|
66
73
|
return $input.length ? status[ isChecked ? 0 : 1 ] : txt;
|
67
74
|
},
|
68
75
|
parsed : true, // filter widget flag
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
/*jshint jquery:true */
|
8
8
|
;( function( $ ) {
|
9
|
-
'use strict';
|
9
|
+
'use strict';
|
10
10
|
|
11
11
|
var prefixes = {
|
12
12
|
// 'prefix' : [ base 10, base 2 ]
|
@@ -23,7 +23,7 @@
|
|
23
23
|
'h|hecto' : [ 1e2, 1e2 ],
|
24
24
|
'da|deka' : [ 1e1, 1e1 ],
|
25
25
|
'd|deci' : [ 1e-1, 1e-1 ],
|
26
|
-
'c|centi' : [ 1e-2, 1e-2],
|
26
|
+
'c|centi' : [ 1e-2, 1e-2 ],
|
27
27
|
'm|milli' : [ 1e-3, 1e-3 ],
|
28
28
|
'µ|micro' : [ 1e-6, 1e-6 ],
|
29
29
|
'n|nano' : [ 1e-9, 1e-9 ],
|
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
/*jshint jquery:true */
|
5
5
|
;(function($){
|
6
|
-
|
6
|
+
'use strict';
|
7
7
|
|
8
8
|
// Change language of the named numbers as needed
|
9
9
|
var named = {
|
@@ -99,7 +99,7 @@
|
|
99
99
|
};
|
100
100
|
|
101
101
|
$.tablesorter.addParser({
|
102
|
-
id:
|
102
|
+
id: 'namedNumbers',
|
103
103
|
is: function () {
|
104
104
|
return false;
|
105
105
|
},
|
@@ -116,7 +116,7 @@
|
|
116
116
|
// make sure to let zero get parsed, so check hasOwnProperty
|
117
117
|
return result || named.numbers.hasOwnProperty( str ) ? result : $.tablesorter.formatFloat( str || '', table );
|
118
118
|
},
|
119
|
-
type:
|
119
|
+
type: 'numeric'
|
120
120
|
});
|
121
121
|
|
122
122
|
})( jQuery );
|
@@ -69,7 +69,7 @@
|
|
69
69
|
// it's fastest & easiest for tablesorter to sort decimal values (vs hex)
|
70
70
|
groups[i] = hex ? ('0000' + groups[i]).slice(-4) :
|
71
71
|
('00000' + (parseInt(groups[i], 16) || 0)).slice(-5);
|
72
|
-
expandedAddress += ( i != validGroupCount-1) ? groups[i] + ':' : groups[i];
|
72
|
+
expandedAddress += ( i != validGroupCount - 1) ? groups[i] + ':' : groups[i];
|
73
73
|
}
|
74
74
|
return hex ? expandedAddress : expandedAddress.replace(/:/g, '');
|
75
75
|
},
|
@@ -5,7 +5,7 @@
|
|
5
5
|
*/
|
6
6
|
/*jshint jquery:true, unused:false */
|
7
7
|
;(function($){
|
8
|
-
|
8
|
+
'use strict';
|
9
9
|
|
10
10
|
// allow lower case roman numerals, since lists use i, ii, iii, etc.
|
11
11
|
var validator = /^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/i,
|
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
return num;
|
36
36
|
},
|
37
|
-
type:
|
37
|
+
type: 'numeric'
|
38
38
|
});
|
39
39
|
|
40
40
|
$.tablesorter.addParser({
|
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
return num ? s.replace(orig, num) : s;
|
77
77
|
},
|
78
|
-
type:
|
78
|
+
type: 'text'
|
79
79
|
});
|
80
80
|
|
81
81
|
$.tablesorter.addParser({
|
@@ -111,7 +111,7 @@
|
|
111
111
|
|
112
112
|
return num ? num : s;
|
113
113
|
},
|
114
|
-
type:
|
114
|
+
type: 'numeric'
|
115
115
|
});
|
116
116
|
|
117
117
|
})(jQuery);
|
@@ -5,142 +5,143 @@
|
|
5
5
|
/*jshint browser:true, jquery:true, unused:false */
|
6
6
|
/*global jQuery: false */
|
7
7
|
;(function($){
|
8
|
-
|
9
|
-
var ts = $.tablesorter;
|
8
|
+
'use strict';
|
9
|
+
var ts = $.tablesorter;
|
10
10
|
|
11
|
-
ts.alignChar = {
|
11
|
+
ts.alignChar = {
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
13
|
+
init : function(table, c, wo) {
|
14
|
+
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
15
|
+
var $this = $(this),
|
16
|
+
vars = {
|
17
|
+
column : this.column,
|
18
|
+
align : $this.attr(wo.alignChar_charAttrib),
|
19
|
+
alignIndex : parseInt( $this.attr(wo.alignChar_indexAttrib) || 0, 10),
|
20
|
+
adjust : parseFloat($this.attr(wo.alignChar_adjustAttrib)) || 0
|
21
|
+
};
|
22
|
+
vars.regex = new RegExp('\\' + vars.align, 'g');
|
23
|
+
if (typeof vars.align !== 'undefined') {
|
24
|
+
wo.alignChar_savedVars[this.column] = vars;
|
25
|
+
ts.alignChar.setup(table, c, wo, vars);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
},
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
30
|
+
setup: function(table, c, wo, v){
|
31
|
+
// do nothing for empty tables
|
32
|
+
if ($.isEmptyObject(c.cache)) { return; }
|
33
|
+
var tbodyIndex, rowIndex, start, end, last, index, rows, val, count,
|
34
|
+
len, wLeft, wRight, alignChar, $row,
|
35
|
+
left = [],
|
36
|
+
right = [];
|
37
|
+
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
|
38
|
+
rows = c.cache[tbodyIndex];
|
39
|
+
len = rows.normalized.length;
|
40
|
+
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
41
|
+
// set up to work with modified cache v2.16.0+
|
42
|
+
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
43
|
+
val = $row.find('td').eq(v.column).text().replace(/[ ]/g, '\u00a0');
|
44
|
+
// count how many 'align' characters are in the string
|
45
|
+
count = (val.match( v.regex ) || []).length;
|
46
|
+
// set alignment @ alignIndex (one-based index)
|
47
|
+
if (count > 0 && v.alignIndex > 0) {
|
48
|
+
end = Math.min(v.alignIndex, count);
|
49
|
+
start = 0;
|
50
|
+
index = 0;
|
51
|
+
last = 0;
|
52
|
+
// find index of nth align character based on alignIndex (data-align-index)
|
53
|
+
while (start++ < end) {
|
54
|
+
last = val.indexOf(v.align, last + 1);
|
55
|
+
index = last < 0 ? index : last;
|
56
|
+
}
|
57
|
+
} else {
|
58
|
+
index = val.indexOf(v.align);
|
59
|
+
}
|
60
|
+
if ( index >= 0 ) {
|
61
|
+
left.push( val.substring(0, index) || '' );
|
62
|
+
right.push( val.substring(index, val.length) || '' );
|
63
|
+
} else {
|
64
|
+
// no align character found!
|
65
|
+
// put val in right or left based on the align index
|
66
|
+
left.push( (count >= 1 && v.alignIndex >= count) ? '' : val || '' );
|
67
|
+
right.push( (count >= 1 && v.alignIndex >= count) ? val || '' : '' );
|
56
68
|
}
|
57
|
-
} else {
|
58
|
-
index = val.indexOf(v.align);
|
59
|
-
}
|
60
|
-
if ( index >= 0 ) {
|
61
|
-
left.push( val.substring(0, index) || '' );
|
62
|
-
right.push( val.substring(index, val.length) || '' );
|
63
|
-
} else {
|
64
|
-
// no align character found!
|
65
|
-
// put val in right or left based on the align index
|
66
|
-
left.push( (count >= 1 && v.alignIndex >= count) ? '' : val || '' );
|
67
|
-
right.push( (count >= 1 && v.alignIndex >= count) ? val || '' : '' );
|
68
69
|
}
|
69
70
|
}
|
70
|
-
}
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
// find widest segments
|
73
|
+
wLeft = ($.extend([], left)).sort(function(a, b){ return b.length - a.length; })[0];
|
74
|
+
wRight = ($.extend([], right)).sort(function(a, b){ return b.length - a.length; })[0];
|
75
|
+
// calculate percentage widths
|
76
|
+
v.width = v.width || ( Math.floor(wLeft.length / (wLeft.length + wRight.length) * 100) + v.adjust );
|
77
|
+
wLeft = 'min-width:' + v.width + '%';
|
78
|
+
wRight = 'min-width:' + (100 - v.width) + '%';
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
80
|
+
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
|
81
|
+
rows = c.cache[tbodyIndex];
|
82
|
+
len = rows.normalized.length;
|
83
|
+
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
84
|
+
alignChar = $(wo.alignChar_wrap).length ? $(wo.alignChar_wrap).html(v.align)[0].outerHTML : v.align;
|
85
|
+
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
86
|
+
last = right[rowIndex].slice(v.align.length);
|
87
|
+
$row.find('td').eq(v.column).html(
|
88
|
+
'<span class="ts-align-wrap"><span class="ts-align-left" style="' + wLeft + '">' + left[rowIndex] + '</span>' +
|
89
|
+
'<span class="ts-align-right" style="' + wRight + '">' + ( last.length ? alignChar + last : '' ) + '</span></span>'
|
90
|
+
);
|
91
|
+
}
|
91
92
|
}
|
92
|
-
|
93
|
-
|
93
|
+
wo.alignChar_initialized = true;
|
94
|
+
|
95
|
+
},
|
94
96
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
remove: function(table, c, column){
|
98
|
+
if ($.isEmptyObject(c.cache)) { return; }
|
99
|
+
var tbodyIndex, rowIndex, len, rows, $row, $cell;
|
100
|
+
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
|
101
|
+
rows = c.cache[tbodyIndex];
|
102
|
+
len = rows.normalized.length;
|
103
|
+
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
104
|
+
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
105
|
+
$cell = $row.find('td').eq(column);
|
106
|
+
$cell.html( $cell.text().replace(/\s/g, ' ') );
|
107
|
+
}
|
106
108
|
}
|
107
109
|
}
|
108
|
-
}
|
109
|
-
};
|
110
|
+
};
|
110
111
|
|
111
|
-
ts.addWidget({
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
112
|
+
ts.addWidget({
|
113
|
+
id: 'alignChar',
|
114
|
+
priority: 100,
|
115
|
+
options: {
|
116
|
+
alignChar_wrap : '',
|
117
|
+
alignChar_charAttrib : 'data-align-char',
|
118
|
+
alignChar_indexAttrib : 'data-align-index',
|
119
|
+
alignChar_adjustAttrib : 'data-align-adjust' // percentage width adjustments
|
120
|
+
},
|
121
|
+
init: function(table, thisWidget, c, wo){
|
122
|
+
wo.alignChar_initialized = false;
|
123
|
+
wo.alignChar_savedVars = [];
|
124
|
+
ts.alignChar.init(table, c, wo);
|
125
|
+
c.$table.on('pagerEnd refreshAlign', function(){
|
126
|
+
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
127
|
+
ts.alignChar.remove(table, c, this.column);
|
128
|
+
});
|
129
|
+
ts.alignChar.init(table, c, wo);
|
130
|
+
});
|
131
|
+
},
|
132
|
+
format : function(table, c, wo){
|
133
|
+
// reinitialize in case table is empty when first initialized
|
134
|
+
if (!wo.alignChar_initialized) {
|
135
|
+
c.$table.trigger('refreshAlign');
|
136
|
+
}
|
137
|
+
},
|
138
|
+
remove : function(table, c, wo, refreshing){
|
139
|
+
if (refreshing) { return; }
|
125
140
|
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
126
141
|
ts.alignChar.remove(table, c, this.column);
|
127
142
|
});
|
128
|
-
|
129
|
-
});
|
130
|
-
},
|
131
|
-
format : function(table, c, wo){
|
132
|
-
// reinitialize in case table is empty when first initialized
|
133
|
-
if (!wo.alignChar_initialized) {
|
134
|
-
c.$table.trigger('refreshAlign');
|
143
|
+
wo.alignChar_initialized = false;
|
135
144
|
}
|
136
|
-
}
|
137
|
-
remove : function(table, c, wo, refreshing){
|
138
|
-
if (refreshing) { return; }
|
139
|
-
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
140
|
-
ts.alignChar.remove(table, c, this.column);
|
141
|
-
});
|
142
|
-
wo.alignChar_initialized = false;
|
143
|
-
}
|
144
|
-
});
|
145
|
+
});
|
145
146
|
|
146
|
-
})(jQuery);
|
147
|
+
})(jQuery);
|
@@ -5,8 +5,8 @@
|
|
5
5
|
/*jshint browser:true, jquery:true, unused:false */
|
6
6
|
/*global jQuery: false */
|
7
7
|
;(function($){
|
8
|
-
|
9
|
-
var ts = $.tablesorter = $.tablesorter || {},
|
8
|
+
'use strict';
|
9
|
+
var ts = $.tablesorter = $.tablesorter || {},
|
10
10
|
|
11
11
|
// build a table from data (requires existing <table> tag)
|
12
12
|
// data.header contains an array of header titles
|
@@ -40,7 +40,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
40
40
|
// valid JSON!
|
41
41
|
return bt.object( table, d, wo );
|
42
42
|
}
|
43
|
-
} catch(ignore) {}
|
43
|
+
} catch (ignore) {}
|
44
44
|
// fall through in case it's a csv string
|
45
45
|
}
|
46
46
|
// Array
|
@@ -57,7 +57,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
57
57
|
|
58
58
|
// even if wo.build_type is undefined, we can try to figure out the type
|
59
59
|
if ( !ts.buildTable.hasOwnProperty(typ) && typ !== '' ) {
|
60
|
-
if (c.debug) {
|
60
|
+
if (c.debug) { console.error('aborting build table widget, incorrect build type'); }
|
61
61
|
return false;
|
62
62
|
}
|
63
63
|
|
@@ -71,7 +71,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
71
71
|
runType(data);
|
72
72
|
})
|
73
73
|
.fail(function( jqXHR, textStatus, errorThrown) {
|
74
|
-
if (c.debug) {
|
74
|
+
if (c.debug) { console.error('aborting build table widget, failed ajax load'); }
|
75
75
|
$tbl.html('<tr><td class="error">' + jqXHR.status + ' ' + textStatus + '</td></tr>');
|
76
76
|
});
|
77
77
|
} else {
|
@@ -105,7 +105,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
105
105
|
|
106
106
|
// *** CSV only options ***
|
107
107
|
build_csvStartLine : 0, // line within the csv to start adding to table
|
108
|
-
build_csvSeparator :
|
108
|
+
build_csvSeparator : ',', // csv separator
|
109
109
|
|
110
110
|
// *** build object options ***
|
111
111
|
build_objectRowKey : 'rows', // object key containing table rows
|
@@ -225,7 +225,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
225
225
|
var c, h,
|
226
226
|
csv = wo.build_type === 'csv' || typeof data === 'string',
|
227
227
|
$t = $(table),
|
228
|
-
lines = csv ? data.replace('\r','').split('\n') : data,
|
228
|
+
lines = csv ? data.replace('\r', '').split('\n') : data,
|
229
229
|
len = lines.length,
|
230
230
|
printedLines = 0,
|
231
231
|
infooter = false,
|
@@ -276,13 +276,13 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
276
276
|
// CSV Parser by Brian Huisman (http://www.greywyvern.com/?post=258)
|
277
277
|
bt.splitCSV = function(str, sep) {
|
278
278
|
var x, tl,
|
279
|
-
thisCSV = $.trim(str).split(sep = sep ||
|
279
|
+
thisCSV = $.trim(str).split(sep = sep || ',');
|
280
280
|
for ( x = thisCSV.length - 1; x >= 0; x-- ) {
|
281
281
|
if ( thisCSV[x].replace(/\"\s+$/, '"').charAt(thisCSV[x].length - 1) === '"' ) {
|
282
282
|
if ( (tl = thisCSV[x].replace(/^\s+\"/, '"')).length > 1 && tl.charAt(0) === '"' ) {
|
283
283
|
thisCSV[x] = thisCSV[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"');
|
284
284
|
} else if (x) {
|
285
|
-
thisCSV.splice(x - 1, 2, [thisCSV[x - 1], thisCSV[x]].join(sep));
|
285
|
+
thisCSV.splice(x - 1, 2, [ thisCSV[x - 1], thisCSV[x] ].join(sep));
|
286
286
|
} else {
|
287
287
|
thisCSV = thisCSV.shift().split(sep).concat(thisCSV);
|
288
288
|
}
|
@@ -304,7 +304,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
304
304
|
bt.buildComplete(table, wo);
|
305
305
|
};
|
306
306
|
|
307
|
-
/* ==== Object example ====
|
307
|
+
/* ==== Object example ====
|
308
308
|
data : {
|
309
309
|
headers : [
|
310
310
|
[
|
@@ -345,9 +345,9 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
345
345
|
}
|
346
346
|
]
|
347
347
|
}
|
348
|
-
*/
|
348
|
+
*/
|
349
349
|
bt.object = function(table, data, wo) {
|
350
|
-
//
|
350
|
+
// 'rows'
|
351
351
|
var j, l, t, $c, $t, $tb, $tr,
|
352
352
|
c = table.config,
|
353
353
|
kh = wo.build_objectHeaderKey,
|
@@ -356,7 +356,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
|
356
356
|
r = data.hasOwnProperty(kr) && !$.isEmptyObject(data.kr) ? data.kr : data.hasOwnProperty('rows') ? data.rows : false;
|
357
357
|
|
358
358
|
if (!h || !r || h.length === 0 || r.length === 0) {
|
359
|
-
if (c.debug) {
|
359
|
+
if (c.debug) { console.error('aborting build table widget, missing data for object build'); }
|
360
360
|
return false;
|
361
361
|
}
|
362
362
|
|