'tabshow' on pageload

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I thought that 'tabshow' was now running anytime a tab was shown, including pageload (see https://community.skuid.com/skuid/topics/run_code_when_tab_loads), but it doesn't seem to be, unless I'm doing something wrong.

I made a comment on that thread, but it's so buried I thought it best to start a new one.

I have this code in-line:

$(document.body).one('pageload',function() {	
// Set tabshow function
$(tabSet).on('tabshow',function(event, data){
console.log(event);
console.log(data);
});
});

But I get nothing in the console.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Joseph Ortiz

Joseph Ortiz

  • 594 Points 500 badge 2x thumb
From my experience, the tabshow event is NOT fired on page load. This resulted in having duplicate code in the page load and on the tabshow. 

If there is a better way, i'd love to know.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
With the introduction of Tab actions - why do you need to go to code for actions taken at tab show?   I've had good success with firing a set of actions on tab load after page load.  It gives the user some temporary page components, and then fires the actions to load the models in the tab...

Nice. 
Photo of Matt Sones

Matt Sones, Champion

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

Are there tabshow actions at the tabset level? I wasn't aware of that. I'd like to avoid setting up the same set of actions for every tab.
Photo of Matt Sones

Matt Sones, Champion

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

I check the tabset parameters, but there are no actions that can be applied to all tabshow events for the tabset. That's why I was working in javascript. I need the same behavior for every tab for large tabsets across multiple pages. Definitely not interested in setting up the same set of actions for each tab panel (unless you give us the reusable custom action sets that Barry has been pushing for, ideally available universally across pages).

So, I suppose I have to duplicate the code for pageload.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Yep.  All that makes sense.  All of it...