Skip to main content
Nintex Community Menu Bar
Question

How Can I Have Only One Drawer (in Queue) Open at a Time?

  • July 9, 2024
  • 8 replies
  • 40 views

Forum|alt.badge.img+3

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.

This topic has been closed for replies.

8 replies

Forum|alt.badge.img+17
  • Nintex Employee
  • 3766 replies
  • July 10, 2024

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…


Forum|alt.badge.img+3
  • Author
  • 21 replies
  • July 10, 2024

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


Forum|alt.badge.img+18
  • 2192 replies
  • July 10, 2024

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 = arguments[0],<br> thisID = args.item &amp;&amp; args.item.drawers &amp;&amp; args.item.drawers[0]._GUID,<br> tems = args.list.visibleItems,<br> drawer,<br> $ = skuid.$;<br>$.each(items,function(index,item){<br> drawer = item.drawers &amp;&amp; item.drawers[0];<br> if (drawer &amp;&amp; (drawer._GUID !== thisID) &amp;&amp; drawer.isOpen) {<br> drawer.close();<br> }<br>});

Forum|alt.badge.img+3
  • Author
  • 21 replies
  • July 10, 2024

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


Forum|alt.badge.img+11
  • 340 replies
  • July 10, 2024

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.


Forum|alt.badge.img+18
  • 2192 replies
  • July 10, 2024

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.


Forum|alt.badge.img+11
  • 340 replies
  • July 10, 2024

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,


Forum|alt.badge.img+4
  • 30 replies
  • July 10, 2024

Works great for me!