Thank you both for the help provided.
I am currently trying the suggestion out. I did find a solution by amending my datalist.php file that seemingly works out fine, but requires me to either set datalist.php to read only or re-set each generation of app (not an issue for me as I have a few other mods in the file anyway).
My temp solution:
File: datalist.php
End of file find this code:
Code: Select all
<script>
$j(function(){
/**
* @brief Saves/retrieves value of column toggle status
*
* @param [in] col_class class of column concerned
* @param [in] val boolean, optional value to save.
* @return column toggle status if no value is passed
*/
var col_cookie = function(col_class, val){
if(col_class === undefined) return true;
if(val !== undefined && val !== true && val !== false) val = true;
var cn = 'columns-' + location.pathname.split(/\//).pop().split(/\./).shift(); // cookie name
var c = JSON.parse(localStorage.getItem(cn)) || {};
/* if no cookie, create it and set it to val (or true if no val) */
if(c[col_class] === undefined) {
if(val === undefined) val = true;
c[col_class] = val;
localStorage.setItem(cn, JSON.stringify(c));
return val;
}
/* if cookie found and val provided, set cookie to new val */
if(val !== undefined){
c[col_class] = val;
localStorage.setItem(cn, JSON.stringify(c));
return val;
}
/* if cookie found and no val, return cookie val */
return c[col_class];
}
/**
* @brief shows/hides column given its class, and saves this into localStorage
*
* @param [in] col_class class of column to show/hide
* @param [in] show boolean, optional. Set to false to hide. Default is true (to show).
*/
var show_column = function(col_class, show){
if(col_class == undefined) return;
if(show == undefined) show = true;
if(show === false) $j('.' + col_class).hide();
else $j('.' + col_class).show();
AppGini.TVScroll().reset();
col_cookie(col_class, show);
}
Modify section: /* if no cookie, create it and set it to val (or true if no val) */
with....
Code: Select all
/* if no cookie, create it and set it to val (or true if no val) */
if (localStorage.getItem("invoices-confirmed") === null){
const field = {"invoices-confirmed": true, "invoices-id": true, "invoices-lock_confirm": true, "invoices-order_type": true, "invoices-code": false, "invoices-status": true, "invoices-date_due": false, "invoices-client": true, "invoices-total": true, "invoices-created": false, "invoices-documents": true, "invoices-zerofix": true, "invoices-zerofix_1": true, "invoices-updated": true, "invoices-paypal": true}
/* CHANGE ABOVE TO SUIT YOUR TABLE COLUMNS WITH DESIRED TRUE OR FALSE
window.localStorage.setItem("columns-invoices_view", JSON.stringify(field));
}