I know this is a very bizarre feature request and it doesn't really make much sense, but it is something I currently need, and perhaps some other people might benefit from it to. I haven't dug into the code yet, but I can't see this being too hard to support.
So the options now are to either load all of the tabs when the page loads, and just toggle between them with JS, or use AJAX to fetch each tab once it's clicked. I need option #3 - to use AJAX to fetch the tabs even if they have already been fetched before.
Why? Well, actions taken on the tabs (in my case) can directly affect what is displayed on the other tab. I need the users to be able to switch between the tabs and see the changes that would result some actions/forms submitted on each of the tabs. As it stands now, they wouldn't be able to see the changes because the content isn't loaded again once it has already been.
Do you think this is a feature we could add to the module? If not, could you point me in the right direction for how to accomplish this, hopefully without having to hack the module.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#20 | quicktabs-add_ajax_always_option-1864800-20.patch | 9.85 KB | NWOM |
Comments
Comment #1
mstef CreditAttribution: mstef commentedWell, we can add an admin-option to enable this. Then check that setting in the JS, and if it's enabled, skip adding the class 'quicktabs-loaded'. The works but then after the second AJAX call, the tab content is appended, rather than replacing what's there. Need to figure that one out..
Comment #2
mstef CreditAttribution: mstef commentedCan take care of that inside the ajax page callback. Use ajax_command_remove() to remove the old content first.
Comment #3
mstef CreditAttribution: mstef commentedHere's my first attempt at a patch. Seems to be working fine.
I added an ajax_always database field and admin option. If it's enabled, the quicktabs-loaded class never gets added, so it get refetched.
I had to include the qt inside the JS settings, so the JS can determine if that option was enabled for the given qt.
I also added ajax_command_remove() to remove the tab content before appending, so it gets updated and not duplicated.
Let me know what you think.
Comment #4
mstef CreditAttribution: mstef commentedLooks like any AJAX inside the tab content doesn't get reattached after one run - ie, the tabs have Views ajax filters and they die after one submit..
Comment #5
mstef CreditAttribution: mstef commentedCan't figure out why the Views AJAX is screwing up.. any suggestions?
Comment #6
mstef CreditAttribution: mstef commentedThis might be helpful: #1868618: Duplicated HTML IDs when using AJAX
Comment #7
mstef CreditAttribution: mstef commentedThe two
Should be
Comment #8
mstef CreditAttribution: mstef commentedAlso experiencing this #1809958: Views with exposed filter (ajax enabled) inside modal window (ctools)
Comment #9
mstef CreditAttribution: mstef commentedUpdated patch with a few tweaks.. still experiencing the Views AJAX issues though.
Comment #10
mstef CreditAttribution: mstef commentedThe error shown in #1809958: Views with exposed filter (ajax enabled) inside modal window (ctools) led me to see what's going wrong here.. The only way that error could come is if the selector returned by Views was no longer valid when Views tried to scroll back to the top.
So, when I first loaded the QT tab, the View DOM ID was: view-dom-id-003082f8146ade5688f0bad80b4a3492
After I reload that same tab via AJAX, the ID becomes: view-dom-id-1
But, Views still expects the first one to exist. Explains the JS error (from above) and why this isn't working..
How to get Views to continually return the same DOM ID; I don't know..
Comment #11
mstef CreditAttribution: mstef commentedHere's a look at Drupal.settings in the console after reloading the tab. Explains why we're getting the DOM id issues.
Comment #12
mstef CreditAttribution: mstef commentedI actually think this patch is good to go. There are numerous 2 bugs in Views that are causing these errors; not Quicktabs or my patch:
#1809958: Views with exposed filter (ajax enabled) inside modal window (ctools)
#1877238: Views caching cannot be combined with Ajax on cached pages
Comment #13
katbailey CreditAttribution: katbailey commentedThere seem to be some unrelated changes in the patch in #9 - can you clean it up and post a new patch with just the changes required for this issue?
I have submitted a patch for overhauling the options system which I'd like people to test out before I commit it: #1877560: Overhaul the options mechanism to make it more sane. I can then help rework your patch based on that change. The Views problem concerns me though so I will see if I can figure out a solution.
Comment #14
kevinorin CreditAttribution: kevinorin commentedCurrently clicking on a tab does not track it in Google Analytics. I think this request may fix that.
dead google analytics thread: http://drupal.org/node/433580
Comment #15
blainelang CreditAttribution: blainelang commentedIs there a more recent patch or an update on this feature request. It's something we were looking to solve for a project as well.
Comment #16
vjorden CreditAttribution: vjorden commentedI don't know if you figured this out...and for others who might be looking for a similar feature, I was able to get this to work by using Views Flag Refresh.
You have to set the Use Ajax to yes in the view itself. With this module, another field appears on the view admin that lets you determine when to refresh the flag.
Hope this helps!
VJ
Comment #17
ashutoshjha CreditAttribution: ashutoshjha commentedHi, You can add this script in your theme .js file and it load tabs each time without appending. In my case it works.
Comment #18
cthshabel CreditAttribution: cthshabel commentedVJ #16 awesome idea!
Thanks for commenting and leaving that info.
I think I will just use Views Flag Refresh module. This seems better for our scenario because only certain tabs need to trigger a refresh, which we can specify for individual views on only specific tabs.
Thanks!
Comment #19
ravibarnwal CreditAttribution: ravibarnwal commentedIt seems "Views Flag Refresh module" module will work with flag (flag module). As #16, #18 It works with quick tabs module. Please, anyone, help me how to use with quick tabs. How to refresh content on click on each tab. Thanks
Comment #20
NWOM CreditAttribution: NWOM commentedHere is a re-roll of #9 against the newest dev. The quicktab settings should however only be shown when the Quicktabs renderer is selected, since it does not function correctly with UI Tabs, etc. This is something that still needs work.
It would be great, if the tab itself could be flagged as always load with ajax, rather than set for all tabs, since it breaks loading elfinder file manager (in my case). Eitherway, this is only a feature request, and could be easily added as another issue after this gets implemented.