Fixed #1020 - DataTable error while using stateStorage with date filter
parent
14fd05f393
commit
f51c05c3f3
|
@ -1428,9 +1428,17 @@ export default {
|
||||||
restoreState() {
|
restoreState() {
|
||||||
const storage = this.getStorage();
|
const storage = this.getStorage();
|
||||||
const stateString = storage.getItem(this.stateKey);
|
const stateString = storage.getItem(this.stateKey);
|
||||||
|
const dateFormat = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;
|
||||||
|
const reviver = function(key, value) {
|
||||||
|
if (typeof value === "string" && dateFormat.test(value)) {
|
||||||
|
return new Date(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
if (stateString) {
|
if (stateString) {
|
||||||
let restoredState = JSON.parse(stateString);
|
let restoredState = JSON.parse(stateString, reviver);
|
||||||
|
|
||||||
if (this.paginator) {
|
if (this.paginator) {
|
||||||
this.d_first = restoredState.first;
|
this.d_first = restoredState.first;
|
||||||
|
|
Loading…
Reference in New Issue