fix(legacy): keep datatable settings between views (#2519)
Use a different storage key for datatable settings for the dashboard and builder views. The settings were overwritten when the other view was loaded.
This commit is contained in:
parent
2fd5b50229
commit
aa98309634
|
@ -59,7 +59,7 @@
|
||||||
"js/airtime/dashboard/versiontooltip.js": "f267c6ec0205e98f1ffba5f636928f7a",
|
"js/airtime/dashboard/versiontooltip.js": "f267c6ec0205e98f1ffba5f636928f7a",
|
||||||
"js/airtime/library/events/library_playlistbuilder.js": "1e0aa11953c7ff243cd2df241cc8a296",
|
"js/airtime/library/events/library_playlistbuilder.js": "1e0aa11953c7ff243cd2df241cc8a296",
|
||||||
"js/airtime/library/events/library_showbuilder.js": "996a5c3008eb17552ee8f891d88c9341",
|
"js/airtime/library/events/library_showbuilder.js": "996a5c3008eb17552ee8f891d88c9341",
|
||||||
"js/airtime/library/library.js": "d47ed07f83c68271b2e3bb50d4eb2b8f",
|
"js/airtime/library/library.js": "aded43b205f22a023cb85724c5945e45",
|
||||||
"js/airtime/library/plupload.js": "7f754a28ac2d4060aec918c688a74a22",
|
"js/airtime/library/plupload.js": "7f754a28ac2d4060aec918c688a74a22",
|
||||||
"js/airtime/library/podcast.js": "f4fd354d739e7121ba00162496c295df",
|
"js/airtime/library/podcast.js": "f4fd354d739e7121ba00162496c295df",
|
||||||
"js/airtime/library/publish.js": "851ef4c4caa9e9220acf945c21760189",
|
"js/airtime/library/publish.js": "851ef4c4caa9e9220acf945c21760189",
|
||||||
|
|
|
@ -864,6 +864,12 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
DATATABLES
|
DATATABLES
|
||||||
############################################ */
|
############################################ */
|
||||||
|
|
||||||
|
if (onDashboard) {
|
||||||
|
var dataTableLocalStorageKey = "datatables-library-dashboard";
|
||||||
|
} else {
|
||||||
|
var dataTableLocalStorageKey = "datatables-library-builder";
|
||||||
|
}
|
||||||
|
|
||||||
mod.libraryDataTable = $libTable.dataTable({
|
mod.libraryDataTable = $libTable.dataTable({
|
||||||
// put hidden columns at the top to insure they can never be visible
|
// put hidden columns at the top to insure they can never be visible
|
||||||
// on the table through column reordering.
|
// on the table through column reordering.
|
||||||
|
@ -882,7 +888,7 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
delete oData.aoSearchCols;
|
delete oData.aoSearchCols;
|
||||||
},
|
},
|
||||||
fnStateSave: function (oSettings, oData) {
|
fnStateSave: function (oSettings, oData) {
|
||||||
localStorage.setItem("datatables-library", JSON.stringify(oData));
|
localStorage.setItem(dataTableLocalStorageKey, JSON.stringify(oData));
|
||||||
|
|
||||||
// Sadly, this is necessary because we need to unscramble the colReorder map on the backend
|
// Sadly, this is necessary because we need to unscramble the colReorder map on the backend
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -895,7 +901,9 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
colReorderMap = oData.ColReorder;
|
colReorderMap = oData.ColReorder;
|
||||||
},
|
},
|
||||||
fnStateLoad: function fnLibStateLoad(oSettings) {
|
fnStateLoad: function fnLibStateLoad(oSettings) {
|
||||||
var settings = JSON.parse(localStorage.getItem("datatables-library"));
|
var settings = JSON.parse(
|
||||||
|
localStorage.getItem(dataTableLocalStorageKey)
|
||||||
|
);
|
||||||
|
|
||||||
// local storage was empty lets get something from the backend
|
// local storage was empty lets get something from the backend
|
||||||
if (settings === null) {
|
if (settings === null) {
|
||||||
|
@ -907,7 +915,10 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
async: false, // <<< every sane browser will warn that this is not nice
|
async: false, // <<< every sane browser will warn that this is not nice
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (oData) {
|
success: function (oData) {
|
||||||
localStorage.setItem("datatables-library", JSON.stringify(oData));
|
localStorage.setItem(
|
||||||
|
dataTableLocalStorageKey,
|
||||||
|
JSON.stringify(oData)
|
||||||
|
);
|
||||||
settings = oData;
|
settings = oData;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue