Jump to content

Using addclass on page list


Joss
 Share

Recommended Posts

I am having trouble modifying elements on the page list in administration.

I am trying to do this:

$('.PageListActions').addClass('test');

(Actually, I am trying something more complicated - but this is a simplified example just to work out the problem)

The problem is that it is simply not taking at all.

I have used similar bits all over an admin theme, but when it comes to the page list, it all falls over - or rather, does nothing at all.

I have tried both $(document).ready(function() { and $(window).load(function() { and stuck it all over the place, but to no avail.

I am assuming it is something to do with how the list is loading, but I dont know what to do about it.

If I work my way backwards, I can addclass to PageListRoot, but not to PageList, which comes after the loading span.

Anyone got any suggestions?

Link to comment
Share on other sites

Hi Joss,

This happens because all the Pages are loaded via ajax. Your Code does not work for content that is loaded dynamically into the DOM.

JQuery provides a function to select also ajax content:

http://api.jquery.com/on/

Now the question: On which event do you want to append this class?

Would work like this:

$(document).on(events, selector, data, handler);  

Maybe you need to hack the ProcessPageList.js?

Cheers

Link to comment
Share on other sites

Okay, that sort of worked.

I got all the required mark up in, but it messed up the way the actual page list worked. Everytime you clicked on a child page, it just added more and more buttons till I had a page of them.

Oh well.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...