Footer actions
Footer actions
can be used to manipulate selected objects of any kind. They appear in a separate toolbar, so that they never conflict with the normal buttons. This toolbar can also be configured with a status message and this checkbox.
The actions
method both sets and gets the actions. If you omit the argument, you"ll get the current actions (jQuery style). In real life, the actions should only appear whenever the user has selected something with the mouse or keyboard, so we will just have to pretend that something is selected.
You can use array methods like push
, pop
, shift
, unshift
, splice
and so on to manage actions, just note that the actions length
is a readonly property. To ensure consistency, actions should always have both an icon and a label, much unlike the buttons.
Hide actions
You can hide()
and show()
actions. You can also toggle visible
.
Disable actions
You can disable()
and enable()
action. You can also toggle disabled
.
Busy actions
We can display a temporary progress indicator with the busy
and done
methods.
The busy
method supports an optional message.
Here"s a summary of the actions
collection and action
model.
Status message
We can configure the actionbar with a status
message. When a selection is made, the massage could be something like "23 products selected". When nothing is selected, it could perhaps be something like "Showing 10-20 out of 123 products".
If you call linkable()
, you can also some links in the message. Beware of phishing!
You can pass a callback function to be invoked whenever a link is clicked.
Checkbox
There's also a checkbox which (conceptually) can be used to manage selections. This is the minimum viable implementation.
You must manually toggle the checked
property. This will give you a chance to let the user confirm if he really intends to select millions of products; or if he really wants to clear a selection that took him hours to complete. Here is the CheckBoxModel
.
Use the indeterminate
property if state that is neither checked nor unchecked. It's a in-between state that can be used show a partial selection and to check all selections.
The example above shows, that the indeterminate
property will take precedence over the checked
property.