Hide fields select box

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
hubert
Posts: 17
Joined: 2018-12-06 22:32

Hide fields select box

Post by hubert » 2018-12-19 08:13

Hi,

I'm quite annoyed with the field selector which is on the table view, upper right of the page.
I do not want some fileds of the table to appear to logged (or not) users, only admins.
But, as I can select the fields, it's alaways possible to make a new selection on hidden fields there .. and I can't accept this
Any key ? May be a javascript routine ?

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 219
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Hide fields select box

Post by jsetzer » 2018-12-19 21:57

Hi Hubert,

hiding the toggle-column-button depending on the current user or group using hooks only is quite complicated. You need to pass current member information from PHP to Javascript or Javascript needs to call a serverside PHP script via AJAX to find out who's logged in.

To hide the column-toggle-button for all users, you can try one of these simple jQuery solutions:

1. Hide button in all table views

Place the following code in hooks/header-extras.php:

Code: Select all

<!-- hooks/header-extras.php -->
<script>
    $j(function() {
      $j('button.tv-toggle').hide();
    });
</script>

2. Hide button in one table view

Create or open the file hooks/TABLENAME-tv.js and put the following code there:

Code: Select all

    $j(function() {
      $j('button.tv-toggle').hide();
    });


From my point of view the toggle-button is very useful, because every single user can reduce the amount of information to the minimum s*he needs. I always use the "Hide in table view" checkbox in AppGini to definately hide columns.

By the way: My Toggle-panel looks a bit different than the default style:

Styled:
chrome_2018-12-19_22-50-33.png
chrome_2018-12-19_22-50-33.png (12.26 KiB) Viewed 310 times
Default:
2018-12-19_22-53-48.png
2018-12-19_22-53-48.png (11.22 KiB) Viewed 310 times

Regards,
Jan

Post Reply