Skip to content

Hide / Show custom tabs

Similar to fade in / fade out function you can conditionally hide or show custom tabs in Detail View without fading-animation.

Custom Tab "Meta"

Code

1
2
3
4
5
6
7
// file: hooks/TABLENAME-dv.js
var dv = AppGiniHelper.DV;
dv.addTab("tabContact", "Ansprechpartner", "user", ["label", "first_name", "..."]);
dv.addTab("tabAssignment", "Zuordnung", "link", ["partner_id", "position", "..."]);
var tabMeta = dv.addTab("tabMeta", "Meta", null, ["created_on", "created_by"]);

tabMeta.hide();

Hide custom tab

1
tab.hide();

Show custom tab

1
tab.show();

Fade Out

1
tab1.fadeOut();
1
tab1.fade(false);

Fade In

1
tab1.fadeIn();
1
tab1.fade(true);
Tip

Use fadeOut (or {hide}()) in combination with getMemberID() for hiding tabs depending on the currently logged in user:

1
2
3
4
5
6
7
8
9
// file: hooks/TABLENAME-dv.js
var dv = AppGiniHelper.DV;
var tabMeta = dv.addTab("tabMeta", "Meta", null,    ["created_on", "created_by", "modified_on", "modified_by"]);
// ... add more tabs here
AppGiniHelper.getMemberID(function(memberID) {
    if (memberID !== 'admin') {
        tabMeta.fadeOut();
    }
});
in Line 6 we ask AppGiniHelper class to request the memberID (username of currently logged in user) from the server and execute a function. As soon as AppGiniHelper got a response, it calls the function and passes the memberID as first (and only) argument.

In Line 7 we check if the username equals admin or not. If not admin, in Line 8 we fadeOut tabMeta.

See also