How do i make TD element editable on double click?
How do i make TD element editable on double click?
istudent_learning
Posts: 31Questions: 9Answers: 0
I would like to insert value on cell on double and post that value to my server. How do i achieve this in data table?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you using the Datatables Editor?
If so you should be able to use this example for inline editing and change the event handler to use
dblclick
https://editor.datatables.net/examples/inline-editing/simple.html
If you are not using Editor then you will need to use an ajax call to send your edits to the server. But without understanding more about what you are wanting its hard to say.
Kevin
I am not using Datatables editor. I am using datatables with manual serverside post ajax call. I need to edit only last td column. it may or may not have value when table loads.
This is how far i reached. dblClick event is not firing.
Please check my below code.
EDIT: Updated code to use Markdown for formatted display.
First I think the events are case sensitive so you may need to change
dblClick
todblclick
. Second you will need to use delegated events for this since the table rows are not created when the event is established. Something like this:Also please use the triple back ticks (```) to format your code. This Markdown doc will show you how.
Kevin