Context Sensetive List in toolbar

In my solution, I have a toolbar that actions upon a grid data.

I want to have a list within the toolbar, that will have it’s base text as “More actions…”, when the list is selected, it will have a different set of options, based on the row highlited in the grid.

How do I go about capturing an event on the base button “More actions…”, so that when it is clicked a new Array is applied ?

I tried to use onStateChange, but it’s too late and the Array is already constructed by than.

We need the demo to reproduce the issue locally. The issue is not clear from description.

There is also onClick event:

toolbar.attachEvent(“onClick”,function(id){

});

Code example is attached.

To recreate:

  1. Click on Radio Button B.
  2. Click the down arrow in toolbar list, expect to see the B option. (not there.)
  3. Click on the “New” label.
  4. Click the down arrow in toolbar list, expect to see the B option. ( now it is there).

Now, I know there are ways to solve this particular example in other ways (for instance, update the toolbar item when the radio button is changed), but this is not a real scenario and is only used to demonstrate the need to have a dynamic list in the toolbar that is created when the toolbar is clicked (and before open).

Just to emphasize, in the real case, the creation of the toolbar list requires a trip to a server based on complex setup, so obviously I don’t want to do this unless there is an explicitclcik on the toolbar.
Copy of 02_init_from_script.zip (869 Bytes)

Any suggestions on this?

Hi.

correct, onClick triggered only if you will click on item, not on the whole item.
suggestions:

  1. change/update item in inside radiobutton onchange handler (i.e. not in onClick)
  2. edit toolbar’s src a bit and continue this way but probably using different implementation - keep item and show/hide options.