Set master view from an interaction


#1

I can’t find how to set a master view using an interaction. I can set an adaptive view, but not a master view.

My use case: I have a toolbar that has some generic button, but also some buttons that apply only depending on how many items are selected. For example ‘New’ works all the time. ‘Edit’ only when one single item is selected. ‘Delete’ works when one or more items are selected.

So my toolbar shall look this:

  • no selection:
    • [New]
  • single selection:
    • [New] [Edit] [Delete]
  • multi selection:
    • [New] [Delete]

Previously I have used a dynamic panel for the three different states with the huge drawback that buttons like [New] appear three times in three different states as independent copies. So I need to keep the interactions on these buttons on all three states in sync.

A master view would be way more elegant here. Especially as I can raise events from the buttons on the toolbar that I can use very cleanly, where I use the toolbar.

However I am stuck now as I do not find a way how to set the master view from an interaction once the selection has changed. As I can set an adaptive view from an interaction it would be pretty inconsistent to not be able to set a master view from an interaction. Hopefully I am just not finding it.


#2

Not sure if this is going to be more work or more helpful…

i recently created this effect by having each click in a selection trigger a check of a global variable.

So when I click a row in a list, it would be something like [[rowSelectedCount + 1]] as the new variable value for rowSelectedCount, and then for OnSelect of the row it would check to see if the count was 0 (New is enabled), 1 (New, Edit, Delete enabled) or greater than 1 (just New and Delete enabled).

Hope this helps. I know it’s not specific with directions but I’m assuming you can pick up what I mean here. I wish there were an easier way.

I’m sure there’s a way to do that easier with masters and raised events but I’m just getting my head around raised events myself…,…


#3

That is exactly what I am doing today with dynamic panels. Works if you enable/disable controls, but that is not a pattern we are using today. We have a toolbar that is responsive to the selection and shows just what is relevant for the current state. Disabling still shows all the controls and therefore shows a more complex view.
And the drawback of dynamic panel is as said: some buttons are duplicate instances. I could show/hide buttons, but then I would also have to move the buttons to compensate for the buttons that disappear in between and that would get way more complex than dynamic panels.