why don't you generate the complete image tag by :toggle and then
update the correpsonding div?
div.innerHtml = updatedImageTagStr;

On Jul 24, 8:04 am, Tim Rand <[email protected]> wrote:
> I AM TRYING TO MAKE A DAMN TOGGLE BOX, BUT USING MY OWN GRAPHIC AND HAVING
> THE MOUSECLICK TRIGGER BOTH SWITCHING THE GRAPHIC (via AJAX) AND SAVING THE
> STATE IN THE DATABASE.
>
> I GOT IT ALL WORKING WITH NORMAL HTML GET CALLS TO THE SERVER, BUT I NEED IT
> TO BE AJAXIFIED SO THAT THE PAGE DOESN'T RELOAD.
>
> AND TO COMPLICATE MATTERS, IT HAS TO WORK IN A TABLE WITH AN ARBITRARY
> NUMBER OF ENTRIES, AND MUST OF COURSE SPECIFICALLY UPDATE ITS OWN ROW ONLY.
> So far:
> I have an orders table. I want to have a graphic within <div id=<%= '"' +
> order.id + '"' + '>' %>IMAGE</div>, which when clicked calls the
> link_to_remote method with an :action => "toggle".
>
> The toggle method then determines the current state of a BOOLEAN field in
> the database, switch that field, and then render with a call to the rjs
> file, which I want to update the image by replacing it with another image.
>
> If this new image is clicked it would go through a similar process to get
> back to the original state.
>
> But alas I cannot quite get there, because I can't seem to figure out how to
> get rjs to take a variable so that it will update only the tag on the row
> where the graphic is found. I basically need to be able to pass in
> order.idas the name of the html id to rjs, which apparently can only
> take strings.
>
> I wonder if a partial would solve this issue? Oh, will I ever be a
> jedi or must I always remain a padawan?
> Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to