Create a JSON with updated data from table

Create a JSON with updated data from table

giaccogiacco Posts: 4Questions: 0Answers: 0

http://live.datatables.net/foleluxe/1/edit?html,output

When the inputs get changed i update row's cells values with javascript.

I need to send the new data to a database using JSON.

When i call dataTable.columns().data() i get old values instead of the updated ones.

How can i get the new data?

I guess i have to update some shadow state of dataTable but i can't understand how.

Thanks

Replies

  • colincolin Posts: 15,095Questions: 1Answers: 2,581

    You would need to get cell().node(), and then get the value of that node.

    It would be worth looking at Editor, as it's designed to make updating tables very straightforward - please see this inline editing example.

    Colin

  • giaccogiacco Posts: 4Questions: 0Answers: 0

    Thanks for the asnwer colin.

    Do you by any chance know why i get a different value from the one shown ?

  • colincolin Posts: 15,095Questions: 1Answers: 2,581

    No, that should always work - as you're just accessing an element in the DOM,

    Colin

Sign In or Register to comment.