How to edit using data tables cells().edit()

How to edit using data tables cells().edit()

minhalminhal Posts: 71Questions: 10Answers: 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

Answers

  • colincolin Posts: 6,861Questions: 0Answers: 1,172
    edited November 9

    Hi @mihal ,

    Are you using Editor - as edit() is part of that extension. If not, you can use cells().data() to change the data in a specific cell.

    Cheers,

    Colin

  • minhalminhal Posts: 71Questions: 10Answers: 0

    Hi @colin,

    I am not using Editor. Can you please provide an example for cells().data() API.

    Thanks,
    Minhal

  • kthorngrenkthorngren Posts: 6,989Questions: 22Answers: 1,520
  • minhalminhal Posts: 71Questions: 10Answers: 0

    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

  • kthorngrenkthorngren Posts: 6,989Questions: 22Answers: 1,520

    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

  • minhalminhal Posts: 71Questions: 10Answers: 0

    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

  • kthorngrenkthorngren Posts: 6,989Questions: 22Answers: 1,520
    edited November 8

    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 :smile:

    Kevin

  • minhalminhal Posts: 71Questions: 10Answers: 0

    Yeah I know, Kevin you have always been a great help. I will try to do it.

    Thanks,
    Minhal

  • kthorngrenkthorngren Posts: 6,989Questions: 22Answers: 1,520

    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

  • tangerinetangerine Posts: 2,415Questions: 18Answers: 270

    @minhal: DT's Editor pays for itself in terms of the time you'll save.

    I don't work here either!

  • minhalminhal Posts: 71Questions: 10Answers: 0

    Thanks @kthorngren and @tangerine for you advice.

Sign In or Register to comment.