So, I''m rolling along learning Rails, finally starting playing with
Ajax, and am embarrassed I waited so long because it''s so darn easy in
Rails. Anyway... I did run into a problem.
I''m trying to make a basic dynamic list, with a text box at the bottom
where you can add an item into the list, and delete links next to each
item to remove. I want to be able to show more than one of these lists
on the same page. So, I created a partial for the div containing the
list, and another partial for the display of each list item. The ajax
for adding one does an update :position => "after". The code for
deleting reloads the whole list from the DB (wasn''t sure if there is an
easy way to dynamically remove one list item? I tried to set the ID of
the div with a variable so that the partials could properly set the
:update param in the ajax code. The problem is, when I render the
partial it doesn''t get the variable because it is only loaded on the
first page load. I know this is a pretty typical use of rails/ajax, so
can someone enlighten me on how best to do this? Hopefully I''ve
explained sufficiently. Feel free to ask for clarification.
Thanks!
Brian
--
Posted via http://www.ruby-forum.com/.