Skip to main content

I’d like to trigger some javascript each time a deck’s card loads. Is there an event or trigger I can tap into?

bump


^^


^^^^

(this should be an easy one, skuid)


^^^^^^



LOL!


This bumpy road is most effective. 

The Deck does not publish any events. You could try and set an event to fire at the same time as the deck is loading.


Stephen,

Thanks. How would I do that?


I am definitely in need of the ability to run a snippet for each card that is loaded with access to that card’s element. A use case right now is trying to set the card background color based on values from that row. No problem in javascript on a table with a field renderer, but I have not figured out a way to do this on a card. 

Latest thought is to throw a dummy field editor and run my renderer there and at the end hide that element. However, that seems hacky at best.


Any development on this? Thanks!!


You can likely use merge syntax somehow to do this. Still need to do this?


I do:)


Lemeno if you can’t figure it out. Set a template above the card with HTML content to use merge syntax to set the class based on field values from the row. You may have to create a Salesforce or Skuid formula to set True/False values to use in the merge syntax.

Then you can use CSS to target the following element and set it’s style.


thanks Pat. I will give that a shot!


Matt, did you ever figure that out?


Ditto Matt question. Any recommendations on what event to set up? Thanks!


Hi Pat, do you have an idea on how to add the event to the deck rendering? attaching to .show won’t work. Cheers. Hope you are staying well and safe!


Event for the deck, column and/or card?


I think it would be best to target the deck itself (though card might work too). I am using page include in cards and want run script to assign the actual PI. Thanks


maybe card would work better…


The one way to do this is for sure a hack.


  1. Put either your deck and/or card components within a tab component.

  2. Next set a class on the tab components of move-me-then-hide-me.

  3. Create a snippet move-children-to-siblings to move the deck/card elements within the tab to be a sibling.

  4. Create css to set the tab component to display: none

  5. Set your deck/card actions in the tab component along with move-children-to-siblings.

Not 100% sure this would work, but lemeno.

Hi all,


We’re considering  adding support for pagination actions and events in the Deck component; Matt Sones, would that solve for your original need, or does it need to be at the card level for it to be useful?


Thanks,

Matt


Thanks, Matt. I honestly don’t remember what the issue was anymore. (‘.’)/


Yes, Matt that would be a start. Card level would be ideal as currently the cards re use id’s so it is a challenge to dynamically do page includes I the cards. I know that wasn’t Matt’s original need but it is one of ours. Thanks