Toolbar
A horizontal (or vertical) container for buttons and other widgets, typically docked to the top or bottom of a Panel. Items overflow gracefully into a menu when the toolbar is too narrow. Use the special string shortcuts '->' (spacer) and '|' (separator) to arrange items. Supports drag-drop reordering of items via enableReordering.
const toolbar = new Toolbar({
items : {
add : { text : 'Add', icon : 'fa fa-plus' },
remove : { text : 'Remove', icon : 'fa fa-minus' },
spacer : '->',
save : { text : 'Save', icon : 'fa fa-check' }
},
appendTo : document.body
});
Useful configs and properties
| Config | Description |
|---|---|
| items | Child widgets (buttons, fields, spacers, separators) |
| overflow | Overflow handling configuration |
| enableReordering | Allow drag-drop reordering of toolbar items |
Arranging widgets
When passing an object (the approach we recommend for defining items), you can use -> as the property value to push widgets to the right side (in LTR):
items : {
leftButton1 : { text : 'Left button 1', icon : 'fa fa-plus' },
leftButton2 : { text : 'Left button 2', icon : 'fa fa-minus' },
spacer : '->',
rightButton1 : { text : 'Right button 1', icon : 'fa fa-gear'}
}
When passing an array of items, you can similarly use the special -> item to push widgets to the right side:
items : [
{ text : 'Left button 1', icon : 'fa fa-plus' },
{ text : 'Left button 2', icon : 'fa fa-minus' },
'->',
{ text : 'Right button 1', icon : 'fa fa-gear'}
]
Toolbar items can be drag-dropped
You can let users reorder the toolbar items by setting enableReordering to true.
weight to order the items.See also
- PagingToolbar - Toolbar with built-in paging controls
- Panel - Panel with
tbar/bbardocking support - Button - Default child widget type
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Set to
trueto allow users to reorder items in this toolbar using drag-dropHas a corresponding runtime enableReordering property.
-
Toolbars override the default
labelPositionfor containers, placing labels before the input fields independent of which theme is used.Has a corresponding runtime labelPosition property.
-
Custom CSS class to add to toolbar widgets
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of Toolbar class, or subclass thereof.
-
Set to
trueto allow users to reorder items in this toolbar using drag-dropHas a corresponding enableReordering config.
-
Toolbars override the default
labelPositionfor containers, placing labels before the input fields independent of which theme is used.Has a corresponding labelPosition config.
-
Identifies an object as an instance of Toolbar class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
onDrop( )private
Handle drop