I have a table with a number of rows. The right most cell contains a
link ‘Delete’ when this is clicked I’d like that row to be removed from
the table.
How can I achieve this?
The approach I’ve tried is wrapping the whole row in a div then when I
the AJAX returns some HTML to update the div it should return nothing.
Is this the best way? Any suggestions?
I have a table with a number of rows. The right most cell contains a
link ‘Delete’ when this is clicked I’d like that row to be removed from
the table.
How can I achieve this?
The approach I’ve tried is wrapping the whole row in a div then when I
the AJAX returns some HTML to update the div it should return nothing.
Is this the best way? Any suggestions?
With your method, there’s going to be a lot of management around each
row having it’s own div and getting refreshed. Instead, I’d recommend
you do the refresh on the entire display of data rows. You may need to
look into using the :collection parm with the render command (syntax is
sometimes a little tricky with how to access the collection members).
It’s quite DRY and easy to maintain.
Assumptions here for purposes of demonstration are that your data has a
“name” field, that you’re using a table layout, and that you are display
:all rows from your data table. You should be able to get the idea here
and adapt to your specific needs.
I’m spewing off the top of my head here, no testing done on this, so I
apologize for any typos or syntax errors.
I have a table with a number of rows. The right most cell contains a
link ‘Delete’ when this is clicked I’d like that row to be removed from
the table.
How can I achieve this?
Assign an id to every row and remove it with Protoype’s Element.remove