App
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:
Switch to Typed (2sxc 16+) Selected: Dynamic (Razor14 or below) Switch to Pre Razor12
⬇️ Result | Source ➡️
New syntax
@Kit.Toolbar.Default()
without any Data
⬇️ Result | Source ➡️
New syntax
@Kit.Toolbar.Default(Content)
with a pre-set content-item
New syntax
@Kit.Toolbar.Default().For(Content)
with a content-item which can be set later
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 ➡️
ui
as inline string
ui
as string variable for reuse
ui
as string for reuse and merge
Mouse over the buttons to see how we use/merge to ui configurations
⬇️ Result | Source ➡️
ui
as inline object
ui
as prepared object
ui
as prepared object merged with other object
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