Is there a way to run onload functions when switching betwee

Posted by Rollbase User on 03-Dec-2010 16:54

On a record view page with tabs (and AJAX Tab Loading = enabled), is there a way I can have a Javascript function executed "on tab load" (since the onload property only works for the first Tab displayed when page is initially loaded)? I know I could disable AJAX page loading, but the Record View page would take too long to load if I did. Thanks

All Replies

Posted by Admin on 05-Dec-2010 11:10

There are several things we can do:
1. Provide option to run onLoad scrip every time the tab changes (this may lead to unwanted effects potentially)
2. Allow new script "on tab change" feature
3. Treat "disable AJAX page loading" as full page refresh (perhaps the safest thing to do).

Please let me know what do you think.

Posted by Admin on 06-Dec-2010 15:56

#1. This would work as long as we remember to check that the function exists on the current tab before calling it to avoid JS errors.

onload:

if (typeof updateFees == 'function') updateFees();


#2. This may be the best way to do it. Add an additional text box on page properties where we can identify script to run "on tab change" similar to how "onload" is done.

#3. Would also work, but the AJAX tabs are a nice feature. Why refresh the whole page when it's not needed?

Posted by Admin on 06-Dec-2010 17:18

OK, will proceed with #2

Posted by Admin on 15-Dec-2010 14:34

I saw your twitter update that this has been implemented, but I don't see the option on the Page Properties. I am just wondering if this been implemented yet?



Thanks

Posted by Admin on 15-Dec-2010 15:02

That is only available on View pages - we do not have tabs on New Record pages.

Posted by Admin on 15-Dec-2010 15:23

Oh my mistake, I was looking at the wrong page!

Posted by Admin on 16-Dec-2010 13:23

Sorry to keep bugging you with this..

The "ontab" change feature will only work when AJAX tab loading is disabled? I thought it was supposed to work with AJAX tab loading enabled.

The whole reason of having the "ontab" change (in my mind, anyway) was to be able to still use AJAX tab loading (since it's quicker than loading all tabs at once), but also be able to run Javascript when a new tab is loaded.

Posted by Admin on 16-Dec-2010 16:02

AJAX loading is not friendly to JavaScript. You're safe when entire page is loaded at once.

Posted by Admin on 16-Dec-2010 16:11

Got it.. Thanks

This thread is closed