Page 1 of 1

Column presets?

Posted: 2020-02-14 10:55
by dge
It's great to have the ability to turn on and off columns. Now we need to make presets so the user can press a button to show and hide certain sets of columns easily, without opening the GUI and clicking them one by one.

Any ideas on how to do this?
David

Re: Column presets?

Posted: 2020-02-16 20:13
by pbottcher
Hi,

you can add to the TABLENAME-tv.js in the hooks folder some code to add you button to there you want an upon click on the button
execute

$j('input[data-col="TABLENAME-FIELDNAME"]').click();

for each field that you want to hide.

Re: Column presets?

Posted: 2020-02-18 01:47
by dge
Thanks very much!

However, I'm not getting it to work. It seems not as simple as entering (in clients-tv.js) $j('input[data-col="clients-dateAdded"]').click();

As well, I would like to trigger groups of fields off/on by clicking buttons. Not sure how to achieve that aspect also.

Alternately, I'm also trying to write the cookies in LocalStorage directly. It seems like a workable method but am having difficulty with getting the exact right data into the cookie. Examining the Appgini generated cookie data in Chrome helps, but somehow can't get it formatted properly for Appgini to read it back.

Any further assistance would be greatly appreciated!

Re: Column presets?

Posted: 2020-02-18 21:40
by dge
Ok, we figured out how to write the appgini cookies in a javascript function:

localStorage.setItem('columns-clients_view', '{"clients-unsubscribe":false,"clients-dateAdded":false,"clients-companyName":true,"clients-EIN":false}');

Substitute your own actual column and table names.
We trigger these functions from buttons on the tableview, so now we have our favorite column presets.