2sxc Toolbar Customization
Since you can do so many things customizing the toolbar, we created a bunch of small examples for you. Note that we are basically providing a list of commands how the toolbar should be modified.
Important: Normally only editors see these toolbars, so clicking on the buttons won't work, except for the ellipsis (…).
The toolbars would usually only appear on hover, but the Tutorial runs in Demo-Mode so you can see them right away. The old samples still only work on hover.
Hover over the various boxes to see the result - like this:
Important: The feature "Public Use of Edit Form" is disabled
If you want this demo to run for anonymous users you would need it. Register your site on patrons.2sxc.org to get access to the feature.Switch to Typed (2sxc 16+) Switch to Dynamic (Razor14 or below) Selected: Pre Razor12
⬇️ Result | Source ➡️
Old syntax
@Edit.TagToolbar()
without any Data
⬇️ Result | Source ➡️
Old syntax
@Edit.TagToolbar(Content)
with a content-item
Add Buttons with SVG Icons (v14.08+)
We've introduced a new feature to allow custom SVG icons for buttons.
Modify a button
When we modify a button, we don't add one, but change the look or behavior of an existing button.
Ways to provide the ui
, parameters
, prefill
Most buttons can have a ui
and a parameters
parameter. Some also have a prefill
. In simple cases you will just use a string to configure this, but in more advanced cases it's easier to use an object.
Objects and strings can also be merged with other objects and strings. A good reason to do this is to prepare a complex ui/parameters/prefill object, and then use it in a loop where you may want small differences in the buttons of each toolbar.
Note that all the following examples use the ui
parameter as it's easy to see the effect. But the behavior is the same for parameters
and prefill
.
⬇️ Result | Source ➡️
Pre12
.
The feature probably works but it's a very old API.
Consider upgrading to a newer version of the API.
⬇️ Result | Source ➡️
Pre12
.
The feature probably doesn't work in this old API.
Consider upgrading to a newer version of the API.
⬇️ Result | Source ➡️
Pre12
.
The feature probably works but it's a very old API.
Consider upgrading to a newer version of the API.
⬇️ Result | Source ➡️
Pre12
.
The feature probably doesn't work in this old API.
Consider upgrading to a newer version of the API.
⬇️ Result | Source ➡️
Pre12
.
The feature probably works but it's a very old API.
Consider upgrading to a newer version of the API.
Data Buttons with Filters
Data
buttons open the management view with a list of items to manage. You will often want to filter what to open - like only open items which have a certain property or have one of 3 tags.
Important: These samples show how to do it, but it won't work in anonymous mode. To see it in full action, you will need to install the tutorial and test it logged in as Admin.
⬇️ Result | Source ➡️
Just call showMsg1()
⬇️ Result | Source ➡️
Just call showMsg2()
and use the parameter id=42