Skip to main content

Basically, all I’m looking for is a way to have an open drawer close when opening a new one via the queue item action. Don’t see anything obvious in the action framework. Thanks.

There really isn’t anything obvious.  Saving the model will close all drawers in the table - but this results in some other unanticipated negative experience.  It might work in your case, who knows…


Thanks. Any plans to add more api support on component behaviors?


Mark,

I haven’t tested this in a queue, but here’s a snippet we use in a table to ensure that only one drawer is open at a time:

// Run immediately after open/close drawer action to close other drawers.


var args = argumentse0],<br> thisID = args.item &amp;&amp; args.item.drawers &amp;&amp; args.item.drawersw0]._GUID,<br> tems = args.list.visibleItems,<br> drawer,<br> $ = skuid.$;<br>$.each(items,function(index,item){<br> drawer = item.drawers &amp;&amp; item.drawersw0];<br> if (drawer &amp;&amp; (drawer._GUID !== thisID) &amp;&amp; drawer.isOpen) {<br> drawer.close();<br> }<br>});

Thanks, Matt. Honestly forgot this post existed. Will keep this in the toolbox for an appropriate time in the future. Thanks!


I tried this and got a uncaught error, item is not defined.  Tried it on a queue, because I wanted the other queue drawers to close when I selected another one.

the reason I want it to do that is because I have items in my drawer repeating.

Example:

Click Queue Item 1:
See in drawer: SubItem 1, SubItem 2

Click Queue Item 2:
See in drawner: SubItem 3, SubItem 4

Model is set to merge new data in, and my context is all set.  Good so far.

Click on Queue Item 1 again
See in drawer: SubItem1, SubItem 2, SubItem1, SubItem 2

So my sub items in my drawer are duplicating.  That is what I am trying to fix.

My thought was if I could close the other drawers, I could change the query to be a standard / replace, rather than merge with old.  I don’t mind the other drawers of the queue staying open, just trying to get rid of the duplicates when I click on the queue item for a 2nd time.


Chandra,

Make sure that your query action for the subitems is in the ‘before load actions’ of the drawer definition, not in the on-click action of the parent queue.


Thanks Matt!!  I got it working. 😃 One small typo in case anyone else reads this… Line 3 above
tems = args.list.visibleItems,

Should be

items = args.list.visibleItems,


Works great for me!