Lines 63-68
var dataTablesDefaults = {
Link Here
|
63 |
$("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled"); |
63 |
$("#" + tableId + "_wrapper").find(".dt_button_clear_filter").removeClass("disabled"); |
64 |
} |
64 |
} |
65 |
}); |
65 |
}); |
|
|
66 |
}, |
67 |
stateSave: true, |
68 |
stateSaveCallback: function (settings, data) { |
69 |
const state = JSON.stringify(data); |
70 |
//get query part of the url |
71 |
let searchParams = new URLSearchParams(window.location.search); |
72 |
//add encoded state into query part |
73 |
searchParams.set($(this).attr('id') + '_state', state); |
74 |
//form url with new query parameter |
75 |
const newRelativePathQuery = window.location.pathname + '?' + searchParams.toString() + window.location.hash; |
76 |
//push new url into history object, this will change the current url without need of reload |
77 |
history.pushState(null, '', newRelativePathQuery); |
78 |
}, |
79 |
stateLoadCallback: function (settings) { |
80 |
const url = new URL(window.location.href); |
81 |
let state = url.searchParams.get($(this).attr('id') + '_state'); |
82 |
|
83 |
//check the current url to see if we've got a state to restore |
84 |
if (!state) { |
85 |
return null; |
86 |
} |
87 |
|
88 |
//if we got the state, add current timestamp |
89 |
state = JSON.parse(state); |
90 |
state['time'] = Date.now(); |
91 |
|
92 |
return state; |
66 |
} |
93 |
} |
67 |
}; |
94 |
}; |
68 |
|
95 |
|
69 |
- |
|
|