DataTables and Rails 3.0.x question
DataTables and Rails 3.0.x question
mklem
Posts: 1Questions: 0Answers: 0
Hello.
Great plugin. Thank you.
I am using DataTables to list my data which is working fine. I am displaying various input types on each row, like text fields, checkboxes, select menus. I noticed that the data is not saved when the form is submitted. Instead new rows are added. I found out why.
Without using DataTables, after each tr element, Rails adds a hidden input to track the id of the record for each row. Something like this:
When using DataTables, this data is removed.
My question is, am I using DataTables incorrectly? Is it only intended to display data and not handle inputs?
Is there a better way to do this?
Thanks
Great plugin. Thank you.
I am using DataTables to list my data which is working fine. I am displaying various input types on each row, like text fields, checkboxes, select menus. I noticed that the data is not saved when the form is submitted. Instead new rows are added. I found out why.
Without using DataTables, after each tr element, Rails adds a hidden input to track the id of the record for each row. Something like this:
When using DataTables, this data is removed.
My question is, am I using DataTables incorrectly? Is it only intended to display data and not handle inputs?
Is there a better way to do this?
Thanks
This discussion has been closed.
Replies
So the question is - how are you telling DataTables that data has been modified or updated? You need to use the API to do this: http://datatables.net/api - specifically fnAddData and fnUpdate. Otherwise DataTables doesn't know that a row has been added / removed / edited.
Allan