Changin data rows using a button
Changin data rows using a button
alang2205
Posts: 18Questions: 11Answers: 0
I am trying to do a simple datatable with 2 columns(Name, age) that look like this
NAME ** AGE **
Steve 15
John 20
Juan 31
The idea here is that with a button i can sum +10 to every table row,
After clicking the button without refreshing the page the table should dynamiclly change to look like this
NAME ** AGE **
Steve 25
John 30
Juan 41
Answers
If you want the data to persist a page refresh, you would need to store the data on a server, and request/send it via ajax. This is easily done using the Editor API - using
edit()
andfield().set()
. Without Editor, you would need to code that functionality yourself,Colin
thanks Colin but that is not exactly what i want to do, the example you gave me it basically update the crud without refreshing i was looking for a button that alter the current data after clicking it, something like this
NAME ** AGE **
Steve 15
John 20
Juan 31 BUTTON
*After clicking the button the dable should sum his values data to 10
NAME ** AGE **
Steve 25
John 30
Juan 41
Use
rows().every()
to loop through all the rows. Userow().data()
to get and set the data. Something like this:http://live.datatables.net/maquwaso/1/edit
Kevin