Running "Open All" Snippet to open all drawers on page but drawers no longer querying respective model correctly anymore.

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Hi All,

To provide some context to my issue I am currently using an aggregate model to group object records (Onboarders) by start date. Each row is aggregated by the onboarders start date and each drawer opens up to show the onboarders who have that start date. See pic below. When each drawer is opened a series of Before Load Actions run to query a separate non-aggregate model to show the appropriate onboarders (matching start dates). 


This currently works well but my overall objective is to get all the drawers to open on page load. 

I am currently working with a snippet that opens all the drawers upon button click (to see if I can get that to work first).

The snippet currently works to open all drawers but only successfully queries the first drawers results and the rest open empty. The snippet is the following:

skuid.$('#sk-32pRqx-807').find('table:first > tbody').children('.nx-item').not('.nx-item-has-drawer').find('.sk-icon-component-pack:visible').click();

My understanding is it is simulating clicking each of the drawer actions. Can anyone help me understand why the drawers are not properly handing the Load Before Actions anymore? Or how to adjust the snippet to correctly open drawers and load the data in each drawer correctly. 

Bonus points if you can also help me to create a snippet that will run the drawer-opening snippet on page load. Thanks!
Photo of Michael Schniepp

Michael Schniepp

  • 1,808 Points 1k badge 2x thumb
  • Confused.

Posted 1 year ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Michael,

If you change your query to 'a get more' instead of a 'standard - replace' , you'll be in good shape. Just make sure you have context conditions set on the components inside the drawer.

if you create a new incline code (not a snippet) in the builder, then pase the code from your snippet inside the pageload function that skuid provides, your code will run on page load.

Happy skuiding!
Photo of Michael Schniepp

Michael Schniepp

  • 1,808 Points 1k badge 2x thumb
Hi There Matt, thanks for the quick reply! The Before Load Actions are currently set to "Get More" as well as proper context conditions set. Like mentioned they work great manually but it seems when the snippet is used to open them all simultaneously something breaks down. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Make sure the models load on page load too.
Photo of Michael Schniepp

Michael Schniepp

  • 1,808 Points 1k badge 2x thumb
I had load on page load for the agg model but not the other. This fixed it perfectly! Thanks!