Has anyone here ever run into the problem of having a list that cycles a class name, in order for alternating lines to have a different color, using the cycle() helper, but had it mess up when using the prototype/ajax helper insert_html?
I'm trying to come up with a solution for this, and this is what I have so far.
I've got a javascript that is included in the page:
Event.observe(window, 'load', function(){
var alternateColor = function(){ $$('li.item').each(function(el, index){ if (index % 2) el.addClassName('alternate'); }); };
alternateColor(); });
And in my form_remote_for, I use the callback "complete" like this:
form_remote_for(:model, :url => example_path, :complete => "alterateColor()") do |f|
The problem is, while the javascript works when reloading the page, it fails to do anything after the form is submitted and the Ajax call is made.