I have been having trouble even learning what to search for on this
issue, so please bear with me.
My page with an issue has two relevant divs:
- one div contains a list of enrolled users in a class
- the other div contains a search box where you can search for members
to add to the class, then click to add them
I can add and remove members just fine using form_remote_for, and my
rjs template works in general.
When a user clicks the button to enroll a user, I want to empty/hide
the table row containing the record to show that their click worked. I
could just rebuild the entire table each time they click, but this
will cause the user interface issues - and it seems wasteful. I can do
this by hand coding an ID, but I don’t understand enough ruby to
create the right kind of variable.
My RJS page:
This line recreates the div with the current list of enrolled users
page.replace_html :enrolledusers, :partial => “enrolledusers”, :object
This line is my test line, and given a table cell with an
id=“customer_1202” it does the correct thing.
page.replace_html :customer_1202, “”
Normally I wouldn’t waste a post on this kind of question as it seems
like something I should have figured out, but all my research leads me
to believe everyone else already knows how to do it.