brixxbox Wiki
Ask or search…
K

setToolbarButtonMode

A toolbar is a set of tools. These tools are assigned to each app present in a workspace in Brixxbox. A general toolbar for an app looks like this.
Starting from left to right. The first button shows the list of records of current app. Second one (plus sign) open a new window of current app to add a new record. Third one is a save button, after adding all details in the app, user needs to click save button to permanently store the record. If the user presses "plus" button after adding required details, the record is not save but a new window will be opened so user should always press save button. Fourth button is a delete buton, as clear from name, it is used for deleting already present records. Next button is "History record" button, it records all the history of records being added.
The sixth button is "File Attachments" button. It is not present in the toolbar by default, system user has to enable it by going into app properties, scrolling down and clicking on "Attachments" checkbox. Next button is "settings" button, on clicking Brixxbox will open current app in edit or development mode with controls on left side and live app panel on right side. Next button shows the documentation available related to current app. Second last button is for openeing current app in a stand alone mode, it is a mode where only this app covers whole screen. Last button (x) is for closing the app. There are relative symbols present on each button so it is easier for user to be able to understand what each button does.
BrixxApi in its setToolbarButtonMode function provides the functionality to enable, disable or hidden. This is helpful in restricting access, functionality to different users, for example end user should not be allowed to delete any record so delete tool bar button should be hidden from these users.

Example

brixxApi.setToolbarButtonMode("brixxToolbarNewRecord", "hidden");

Parameters

  1. 1.
    toolbarButtonId - This is first parameter. It is build in button ids assigned by Brixxbox to each toolbar button. These id are as follows:
    • brixxToolbarList - For listing records button.
    • brixxToolbarNewRecord - For adding records button.
    • brixxToolbarSaveRecord - For saving records button.
    • brixxToolbarDeleteRecord - For deleting records button.
    • brixxToolbarHistory - For checking records history button.
    • brixxToolbarDiscussion - For discussion button.
    • brixxToolbarAttachments - For adding attachments button.
    • brixxToolbarEditConfigNewTab - For opening app in edit panel button.
    • brixxToolbarShowAppWiki - For show wiki documents button.
    • brixxToolbarOpenFullSize - For opening app in full size button.
  2. 2.
    mode - This is second parameter. It sets the state of respective button. These states are as follows:
    • "disabled" (or false or not clickable)
    • "enabled" (or true or clickable)
    • "hidden"

Example Usages

System user needs to pass button id and mode as a string parameters to this function. Lets suppose system user wants to hide a delete button from end users, there are many ways to do it. Let do it on an event when this app starts. Now we need to go to app properties and add event "onAppStart". Here we will place our code to hide delete button.
brixxApi.setToolbarButtonMode("brixxToolbarDeleteRecord", "hidden");
After this save the app and try it. Now to toolbar should look like this:
Lets now hide all the buttons available in the toolbar on app start. For this we need to add below code to an event "onAppStart" custom code.
brixxApi.setToolbarButtonMode("brixxToolbarList", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarNewRecord", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarSaveRecord", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarDeleteRecord", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarHistory", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarDiscussion", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarAttachments", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarEditConfig", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarEditConfigNewTab", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarShowAppWiki", "hidden");
brixxApi.setToolbarButtonMode("brixxToolbarOpenFullSize", "hidden");
As you can see all the toolbar buttons are hidden except the "info" button. This is the default functionality.