Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#10 | tribune.ajax_.jpg | 24.89 KB | Flying Drupalist |
Comments
Comment #1
SeeSchloss CreditAttribution: SeeSchloss commentedI'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?
Comment #2
Flying Drupalist CreditAttribution: Flying Drupalist commentedI 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.
Comment #3
Flying Drupalist CreditAttribution: Flying Drupalist commentedHi, do you have any thoughts on this?
Thanks. :)
Comment #4
SeeSchloss CreditAttribution: SeeSchloss commentedWell... 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...
Comment #5
Pasqualle#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..
Comment #6
Flying Drupalist CreditAttribution: Flying Drupalist commentedHi, 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?
Comment #7
PasqualleI 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..
Comment #8
katbailey CreditAttribution: katbailey commented@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.
Comment #9
Flying Drupalist CreditAttribution: Flying Drupalist commentedThank 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.
Comment #10
Flying Drupalist CreditAttribution: Flying Drupalist commentedAdditionally 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.
Comment #11
katbailey CreditAttribution: katbailey commentedyes, 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.
Comment #12
Flying Drupalist CreditAttribution: Flying Drupalist commentedThanks 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.
Comment #13
Manuel Garcia CreditAttribution: Manuel Garcia commentedJust 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 throughtemplate_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.
Comment #14
katbailey CreditAttribution: katbailey commentedI'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
Comment #15
sapiusenator CreditAttribution: sapiusenator commented#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!!
Comment #16
katbailey CreditAttribution: katbailey commentedHi 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
Comment #17
katbailey CreditAttribution: katbailey commentedOK, this problem should be fixed now...
http://drupal.org/cvs?commit=338260
Comment #18
joshua.howell CreditAttribution: joshua.howell commentedI 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.
Comment #19
katbailey CreditAttribution: katbailey commented@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.
Comment #20
joshua.howell CreditAttribution: joshua.howell commentedSorry 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.
Comment #21
JaceRider CreditAttribution: JaceRider commentedFrom 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.
Comment #22
katbailey CreditAttribution: katbailey commentedDoh! 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! ;-)
Comment #23
momper CreditAttribution: momper commentedsubscribe
Comment #24
Manuel Garcia CreditAttribution: Manuel Garcia commentedI 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.
Comment #25
kukle CreditAttribution: kukle commentedThis 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?
Comment #26
e-m-h CreditAttribution: e-m-h commentedI'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.
Comment #27
qqboy CreditAttribution: qqboy commentedi 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.