Toolbar Class Reference
This class allows to set the toolbar title, add action buttons and manage tabs. All methods in this class are static.
Toolbar.setTitle(title) Toolbar.addButton(label, onclick, style) Toolbar.addTab(label, onclick) Toolbar.setStyle(style) Toolbar.setColor(color) |
Toolbar.setTitle(title)
set the toolbar title with the title (string) parameter
Toolbar.setTitle("Edit Task");
Toolbar.addButton(label, onclick, style)
Adds a button in the toolbar.
- label (string) is the button label
- onclick (string) is the callback function
- style (string) is an optional value: can be "new", "edit", "delete", "sortby", "camera"
The optional style parameter is used on native apps to use platform specific icons for these predefined actions
Toolbar.addButton("New", "newTaskActivityPopup({id})", "new"); Toolbar.addButton("Edit", "editTask({id})", "edit"); Toolbar.addButton("Export PDF", "exportTask({id})");
Toolbar.addTab(label, onclick)
Adds a tab to the current screen. label (string) is the tab label. onclick (string) is the callback function to execure when the tab is pressed.
Toolbar.addTab("List", "viewList()"); Toolbsar.addTab("Map", "viewMap()");
Toolbar.setStyle(style)
Set a special style for the toolbar. Supported styles are:- style="edit" : used in Edit screen. Replaces the standard Back button by a Done button or icon
- style="nextprevious" used in View screen. Adds a back and forward icon arrows to perform back / previous naigation item using the previous screen list items
- style="search" : used in list view screen. Adds a search icon to perform filtering of the current list
nextprevious and search are supported on native app only and ignored for web
Toolbar.setColor(color)
set the toolbar color on mobile phones and tablets.
- color is string color parameter in hexa.
- You can use predefined value, like Color.BLUE, Color.GREEN, Color.ORANGE, Color.RED, Color.GRAY, Color.PURPLE
Toolbar.setColor(Color.ORANGE);