How to edit using data tables cells().edit()
How to edit using data tables cells().edit()
minhal
Posts: 76Questions: 12Answers: 0
Hi,
I am trying to edit my rows in my datatable but I am not able to figure out a way to use the below example in my tables.
var myTable = $('#myTable').DataTable();
myTable.cells( '.selected' ).edit();
Thanks,
Minhal
This discussion has been closed.
Answers
Hi @mihal ,
Are you using Editor - as
edit()
is part of that extension. If not, you can usecells().data()
to change the data in a specific cell.Cheers,
Colin
Hi @colin,
I am not using Editor. Can you please provide an example for cells().data() API.
Thanks,
Minhal
Colin has an example in this thread:
https://datatables.net/forums/discussion/comment/160743#Comment_160743
Kevin
Hey @kthorngren ,
I am trying to do editing which can be of any kind of editing on the data tables.
This is a example which I have, I am looking to apply editing for rows in this data table.
http://live.datatables.net/xewawena/1/edit
Thanks,
Minhal
Are you trying to do inline editing or using a form?
Are you wanting buttons in the row that allow for edit and delete of that row? If so this example should help:
http://live.datatables.net/xijecupo/1/edit
Or are you wanting the edit buttons like a typical Editor config:
https://editor.datatables.net/examples/simple/simple.html
There's lots of ways to do this if you don't want to purchase the Editor. Maybe you can update your example to show what you want to do and we can help from there.
Kevin
Yes I am looking to do something really simple by editing the row.
http://live.datatables.net/xijecupo/1/edit
I think the above link is not working as its not allowing to edit the row.
Thanks,
Minhal
Its not meant to allow editing. Its a simple example I have to show how to use buttons within a row. You will need to write the code to handle the editing of the data. The example shows you how to get the row data. Its up to you to present the editing for then to handle updating the Datatable with the changed data and, if needed, sending to the server for permanent storage.
Another option is to purchase the Editor. $119 is a small price to pay to not have to code the editing of a table. Want to mention that I'm not employed by Datatables
Kevin
Yeah I know, Kevin you have always been a great help. I will try to do it.
Thanks,
Minhal
If yuo are going to try yourself I suggest you start with the example you posted:
http://live.datatables.net/xewawena/1/edit
You won't be able to save the data to a DB but you will be able to build most of what you want. And as you have questions we can easily take a look because you will have the test case.
Kevin
@minhal: DT's Editor pays for itself in terms of the time you'll save.
I don't work here either!
Thanks @kthorngren and @tangerine for you advice.