ajax enabled views - load additional .js
30equals - November 9, 2009 - 22:22
| Project: | Views |
| Version: | 6.x-2.0 |
| Component: | page displays |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
hey
in my drupal site i have some custom jquery functions which run on a page load. the .js is been added through a drupal_add_js in my template.php
now, with ajax enabled, the .js doesn't get loaded anymore on each page of my view.
is there a views hook i should use or something, so on every ajax load, the .js gets called ?
thanx!

#1
You could use preprocess_page to get every activ js-files and if ajax_view.js is there you add your own.
#2
mmm.. i put my drupal_add_js functions in the preprocess_page now, but it's still the same.
it's not that the jquery isn't there, but my dom manipulation only works on the first page load. when applying filters or paging to my ajax enabled view, the functions don't get applied to my elements in the page.
#3
allright, found it!
with the following function in my .js, i can execute functions on each ajax load:
Drupal.behaviors.myBehavior = function (context) {
....
};
#4
Ahh, that's just your .js not using the API correctly then.
#5
how so ?
my jquery is manipulating some view rows, and i added the .js in my template.php.
if there's a better way please do share it.
#6
Sorry, I meant the original problem. Using behaviors is the correct way. =)
#7
allrighty then ;)
#8
Automatically closed -- issue fixed for 2 weeks with no activity.