mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
ColumnSelector: Set state to null for disabled columns
Fixes JSON issues with not storing "undefined" values
This commit is contained in:
parent
ff754c177e
commit
76f85018d8
2
dist/js/widgets/widget-columnSelector.min.js
vendored
2
dist/js/widgets/widget-columnSelector.min.js
vendored
File diff suppressed because one or more lines are too long
@ -72,14 +72,14 @@
|
|||||||
isArry = $.isArray(optState || optName),
|
isArry = $.isArray(optState || optName),
|
||||||
wo = c.widgetOptions;
|
wo = c.widgetOptions;
|
||||||
// see #798
|
// see #798
|
||||||
if (typeof optName !== 'undefined' && colSel.$container.length) {
|
if (typeof optName !== 'undefined' && optName !== null && colSel.$container.length) {
|
||||||
// pass "selectors" to update the all of the container contents
|
// pass "selectors" to update the all of the container contents
|
||||||
if ( optName === 'selectors' ) {
|
if ( optName === 'selectors' ) {
|
||||||
colSel.$container.empty();
|
colSel.$container.empty();
|
||||||
tsColSel.setupSelector(c, wo);
|
tsColSel.setupSelector(c, wo);
|
||||||
tsColSel.setupBreakpoints(c, wo);
|
tsColSel.setupBreakpoints(c, wo);
|
||||||
// if optState is undefined, maintain the current "auto" state
|
// if optState is undefined, maintain the current "auto" state
|
||||||
if ( typeof optState === 'undefined' ) {
|
if ( typeof optState === 'undefined' && optStates !== null ) {
|
||||||
optState = colSel.auto;
|
optState = colSel.auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,12 +140,13 @@
|
|||||||
// include getData check (includes 'columnSelector-false' class, data attribute, etc)
|
// include getData check (includes 'columnSelector-false' class, data attribute, etc)
|
||||||
if ( isNaN(priority) && priority.length > 0 || state === 'disable' ||
|
if ( isNaN(priority) && priority.length > 0 || state === 'disable' ||
|
||||||
( wo.columnSelector_columns[colId] && wo.columnSelector_columns[colId] === 'disable') ) {
|
( wo.columnSelector_columns[colId] && wo.columnSelector_columns[colId] === 'disable') ) {
|
||||||
|
colSel.states[colId] = null;
|
||||||
continue; // goto next
|
continue; // goto next
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default state; storage takes priority
|
// set default state; storage takes priority
|
||||||
colSel.states[colId] = saved && typeof saved[colId] !== 'undefined' ?
|
colSel.states[colId] = saved && (typeof saved[colId] !== 'undefined' && saved[colId] === null) ?
|
||||||
saved[colId] : typeof wo.columnSelector_columns[colId] !== 'undefined' ?
|
saved[colId] : (typeof wo.columnSelector_columns[colId] !== 'undefined' && wo.columnsSelector_columns[colId] !== null) ?
|
||||||
wo.columnSelector_columns[colId] : (state === 'true' || state !== 'false');
|
wo.columnSelector_columns[colId] : (state === 'true' || state !== 'false');
|
||||||
colSel.$column[colId] = $(this);
|
colSel.$column[colId] = $(this);
|
||||||
|
|
||||||
@ -415,7 +416,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$cell.addClass( filtered );
|
$cell.addClass( filtered );
|
||||||
}
|
}
|
||||||
} else if ( typeof colSel.states[ col ] !== 'undefined' ) {
|
} else if ( typeof colSel.states[ col ] !== 'undefined' && colSel.states[ col ] !== null ) {
|
||||||
$cell.toggleClass( filtered, !colSel.states[ col ] );
|
$cell.toggleClass( filtered, !colSel.states[ col ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user