I want to call the tribune block via ajax, but of course that doesn't work.

What's the best way to make it work? I recently discovered http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query
which might be a way to handle the issue, or use "event delegation", I'm not sure what that is.

Do you think this support is feasible? Thanks.

CommentFileSizeAuthor
#10 tribune.ajax_.jpg24.89 KBFlying Drupalist
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SeeSchloss’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not sure what you mean by "calling the tribune block via ajax"? Just sending messages, or getting messages, or getting the whole block in HTML form?

Flying Drupalist’s picture

I would like to put the tribune block inside a quicktabs ajax Tab. So that the block is shown only when the tab is selected.

Simply doing that makes the tribune block lose all javascript, I would like to summon the block with ajax and still be able to use it normally. Thanks.

Flying Drupalist’s picture

Hi, do you have any thoughts on this?

Thanks. :)

SeeSchloss’s picture

Title: Tribune in Ajax » Quick Tabs do not load Javascript and CSS files included by a block
Project: Tribune » Quick Tabs
Version: 6.x-1.x-dev » 6.x-2.0-rc3
Category: support » feature

Well... I've just tried it, and it seems to me that the problem is different : my module's javascript is not loaded at all. If it was, it should work fine regardless of whether I am using livequery or not.

The block hook just does drupal_add_js(drupal_get_path('module', 'tribune') .'/js/tribune.ajax.js'); before returning the block contents, and it looks like quicktabs doesn't quite understand that it should include the js too?

The css from drupal_add_css isn't loaded either.

I'm changing this issue to the quicktabs project, but if there's anything I can do on my side (except including the javascript and css on every page when the module is enabled, of course) to make it work...

Pasqualle’s picture

Status: Postponed (maintainer needs more info) » Active

#345175: what could be inside ajax quicktabs
I don't know what could I add to this issue. This simply does not work at current state.
You have to switch to non-ajax quicktab..

Flying Drupalist’s picture

Hi, thanks for your help.

Pasqualle, as the other issue says, is the problem here?
http://drupal.org/node/251578

Isn't it fixed? What else is needed?

If the problem is just the js and css not being loaded, I think I can just include them in the theme, since once aggregated and compressed, I don't think they're that big. Is that a good temporary solution?

Pasqualle’s picture

I am not a js expert, but as I see we need much more than #251578: More flexible js/css ordering and an alter operation

Yes, if at page load you add the necessary js and css files for the ajax loaded content, then it should work..

katbailey’s picture

Title: Quick Tabs do not load Javascript and CSS files included by a block » Quick Tabs do not load extra JavaScript and CSS files required by ajax-loaded content
Issue tags: +JavaScript, +Ajax

@Miraploy that issue is for D7 - this functionality will never be supported in core in Drupal 6 as far as I know. What you need is to make sure the required js and css files will be loaded on the page. If additional js settings are required, then that's another matter and again is being addressed in D7 core (see #360081: Pass Settings Locally to JS Behaviors) but not D6.

Flying Drupalist’s picture

Thank you for all of your help. I loaded the tribune ajax in every page. And in the block itself the tribune works fine.

However clicking on the tab to get to the tribune block reloads the page rather than insert the block by ajax.

Help on this matter would be appreciated.

Flying Drupalist’s picture

FileSize
24.89 KB

Additionally I get this error. (attachment)

I think this is the settings thing you were talking about katbailey. I what probably happened was that the js error broke quicktabs js, leading to the page refresh. :(

Is there nothing that could be done?

Edit:

This error appears even when there is no QT with a tribune block on page.

katbailey’s picture

yes, this is because tribune requires extra js settings as well as the js file that you're loading on every page. And as explained above, Drupal 6 has no mechanism for updating Drupal.settings with new settings for content loaded via ajax.

Flying Drupalist’s picture

Thanks katbailey, I don't understand exactly what's stopping quicktabs from using one of the existing D6 mechanisms for updating settings, such as using the ajax load module or using the popups example.

Whatever is the case, I would be willing to chip in though to get settings to be loaded for D6.

Manuel Garcia’s picture

Just for the record, I believe this is also affecting Views using the views_accordion style plugin, which prepares settings and adds a js file on render(), and a css file through template_preprocess_views_view_accordion.

These files are not being added if the tab is being loaded through ajax, otherwise both modules work perfectly together.

I'm the maintainer of views_accordion btw, and will be helping testing this issue if we come up with a solution.

katbailey’s picture

I've just committed a fix for this, thanks to Merlinofchaos. I've implemented the same solution he uses in the CTools AJAX framework. Please test the latest dev version.
http://drupal.org/cvs?commit=332432

sapiusenator’s picture

#14
Hard to recreate this error - here is an explanation of what I can tell you.

Create 2 quicktab blocks each with 2 tabs with the first quicktab pulling the second quicktabs block into it's second tab.
Test the first quick tab block - when you click on tab 2 which has the second quicktab block in it everything is good - when you click back to tab 1 it will change you to the URL of the first tab.
Now if you click on the second tab everything should be good again (except it reloads the tab using ajax again) then you click the first tab and it should be unresponsive.

I have also tested this programmatically. It seems to be only when a second qt block is loaded into another qt block as a tab.

Note all the tabs are working properly and if I don't follow those steps exactly then sometimes it behaves perfectly fine.

Please send me a private message for more details if required.
Thanks for this awesome module!!

katbailey’s picture

Version: 6.x-2.0-rc3 » 6.x-2.x-dev

Hi sapiusenator,
thanks for the detailed steps to reproduce - I can confirm the problem. I'll have a look into it and hopefully get it fixed soon - I have an idea that it might be to do with the fact that before this fix, we had already implemented measures to at least allow for ajax-loading of qtabs with their required js settings, so maybe this doubling-up is causing the problem.

Katherine

katbailey’s picture

OK, this problem should be fixed now...
http://drupal.org/cvs?commit=338260

joshua.howell’s picture

I have not been able to get any Ajax enabled quicktabs to load js/css files using the latest Quicktab releases (both rc4 and dev) but there is a workaround which is working for views carousel at least. Install the Ajax Load module (don't worry about example just the main module) and it should be working. I am using Quicktabs 6.x-2.0-rc4 and Views Carousel 6.x-2.x-dev. Installing this module also appears to resolve issues with Lightbox 2 not loading images in quicktabs.

katbailey’s picture

@joshua.howell, can you please explain what is not working with the latest dev release, i.e. steps to reproduce? This should work without Ajax Load module.

joshua.howell’s picture

Sorry for the late reply. I installed the latest dev release and was not able to get any content which included extra javascripts to function (views Carousel for example, and thickbox), to work in Ajax loaded quicktabs of views content. If i called the javascripts inside the view itself then it would work. maybe i stuffed something up but Ajax Load module resolved my issues.

JaceRider’s picture

From what I can tell, css and js files are not being loaded for any Quicktab views. The code that was added only seems to affect non-view tabs.

katbailey’s picture

Doh! Yes, I had meant to post an update about this earlier :-( Because Views are treated differently the fix doesn't get applied to them. I'll look into whether that can be changed - in the meantime, if anyone else wants to have a go, patches are more than welcome! ;-)

momper’s picture

subscribe

Manuel Garcia’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev

I don't think this is going to get fixed in d6 guys, however, in d7, this will be possible, now that #561858: [Tests added] Fix drupal_add_js() and drupal_add_css() to work for AJAX requests too by adding lazy-load to AJAX framework has gotten in. I'm willing to guess this is no longer a problem in D7, though no time to test it... any takers? You can try using views_accordion, it's got a 7.x version to play with.

kukle’s picture

This doesn't work here with 7.3-dev. The readme-file says I can set the number of tabs, but I can't. Anybody an idea?

e-m-h’s picture

I'm also seeing this issue using D7, Quick tabs 1.2-beta 1, and Views Accordion (I know this isn't the correct version for this thread, but seems to make sense to post here anyways).

I have a number of views blocks setup using view accordion. Quick tabs are setup to display a views accordion block on each tab, Ajax is set to YES. The first tab (loaded by default) displays correctly. On the subsequent tabs the accordion views break.

When Ajax is set to "No" all views work correctly.

Interesting note, when displaying a views accordion block that is not in QT, but is displayed on the same page, the accordion views then work correctly within QT.

qqboy’s picture

Issue summary: View changes

i m sorry to tell you that normally quicktab can not load extra js files for second tab if ajax_load setting in quicktab settings is disabled, then after searching i found a way to do it by using $.getscript;

if some one knows a better way, please let me know thanks.