Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Keith

Can I write JQuery after e.fn.cacie_savecolumn?

Hello…

I am colour coding cells (background and text) based on the content within them. For example, if a Project is “late” and still “incomplete” – the appropriate cells have a yellow background and red text.

This works well on initial load of the page.

However, if someone modifies the content of a cell, I want the colour coding to reflect the change.

Now, I got as far as creating, registering, and enqueing an external .js file.

And… within ‘acp/editing/saved’ I call: ‘wp_localize_script’ to pass the JS some values (column names, classes, etc) dynamically..

In the JS I am attempting to “removeClass” and then “addClass” – I have no idea if that will work.. but… I am getting a bunch of JS errors, before I can even test it….

I think I know why… I would like to conditionally write the JQuery statements…
I am still educating myself on JS, AJAX, JQuery… but I got as far as to see in the Console that there is something called: e.fn.cacie_savecolumn within ‘XHR finished loading’

Does it seem like a good idea to print my JQuery within a conditional that says something like: do after e.fn.cacie_savecolumn ???

If so… how? I tried a bunch of different things with no luck.

Thanks!
Keith

6 years, 6 months ago
Stefan van den Dungen Gronovius
Developer

Hi Keith,

If I understand you correctly you can try the following JS event in your code

jQuery( 'document' ).on( 'cacie_after_save', function( event, column, item, newvalue ) {} );

The cacie_after_save event is fired after the result is returned by the Ajax call and already replaced in the DOM.
To be honest I haven’t played with this event myself, but I’m curious what you’ve come up with.

6 years, 6 months ago

You must be logged in to reply to this topic.