Manage the toolbar of AskiaPortal.
portal.toolbar.append({
tools : [
{id : "button1", text: "Classic", title: "Button to do one..."},
{id : "button2", text: "Disabled", title: "Button to do two...", disabled : true},
{id : "button3", text: "Main action", title: "Button to do the main action...", usePrimaryStyle: true},
{id : "button4", text: "Open new window", title: "Button to do the open a new window ...", targetUrl: "https://my.url.to.open"},
{
id : "button5",
text: "Drop down menu",
title: "Button with drop down menu ...",
children : [
{ id : "button5-subItem1", text : "Classic menu", title: "Classical sub-menu"},
{ id : "button5-subItem2", text : "Disabled menu", title: "Disabled sub-menu", disabled : true}
]
}
]
}).then(() => {
// Listen event on the toolbar
portal.toolbar.addEventListener("click", (event, details) => {
console.log(`The tool with the id '${details.id}' has been clicked!`);
});
});
Dependencies:
- ./js/portal.channel.js
- ./js/portal.EventEmitter.js
- Mixes In:
Methods
(static) Toolbar#append(options) → {Promise}
Append tools in the toolbar.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options Properties
|
Returns:
- Type
- Promise
(static) Toolbar#clear() → {Promise}
Remove all tools in the toolbar.
Returns:
- Type
- Promise
(static) Toolbar#disable(options) → {Promise}
Disable tools in the toolbar.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | Options Properties
|
Returns:
- Type
- Promise
(static) Toolbar#enable(options) → {Promise}
Enable tools in the toolbar.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | Options Properties
|
Returns:
- Type
- Promise
(static) Toolbar#remove(options) → {Promise}
Remove tools in the toolbar.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | Options Properties
|
Returns:
- Type
- Promise
(static) Toolbar#update(options) → {Promise}
Append tools in the toolbar.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options Properties
|
Returns:
- Type
- Promise
Events
click
When the user click on the tool.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
details |
Object | Details of the click event Properties
|