Hi All,
I'm looking for a way to append elements with javascript using
javascript. Basically I have two lists of items. One has a list of
items with an "ADD" button (using "link_to_remote") and the other has
a list of items with a "REMOVE" button (using "link_to_remote"). When
I click the "ADD" it immediately places the item into the other list.
However, I need to be able to have the newly inserted item perform the
reverse action for "REMOVE".
I see no way (besides, perhaps creating a partial to render a non-
object) to dynamically generate dynamic items of this nature.
Any ideas?
Best.
I am not sure what your problem is. Please provide more detail and
code.
Basically I have two partials that render. One is the "Available
Items" and the other is "Selected Items". If I select an "Available
Item" then it gets added to "Selected Items". However, if I remove a
"Selected Item" I need it to go back to "Available Items". When they
are initially rendered from the VIEW code, both work just fine.
However, I need to dynamically insert javascript for each newly added
unordered list item to either column. Currently I'm actually using a
partial within a partial to manage each new item. It adds a
"link_to_remote" item for each newly added item. My "issue" is that
I can't figure out how to use the javascript helpers via the
"render :update" method in the controller so I have to call a partial
in order to insert the appropriate code. I could very likely be
asking the wrong question(s)
The reason I need it to update immediately is because it is a multi-
user setup and if one user has selected an item, I need it to
immediately be "taken out" of circulation. In either case, I'd still
need dynamic code to, at the very least, move the items back and
forth.