Datatable - only want edit for two columns
Datatable - only want edit for two columns
sherin
Posts: 18Questions: 1Answers: 0
I have five columns in datatable and I need to edit 2nd and third column only.
code :
$('#otable').on( 'click', 'tbody td:not(:first-child):not(:last-child)', function () {
}
Above one just escapes first and last, and now, the 2nd, 3rd and 4th column are editable. but I need only 2nd and 3rd column as editable. please help!
This discussion has been closed.
Replies
Easiest option is probably just to add a class to the columns you do want to be editable - for example
editable
, which can be done withcolumns.className
. Then your selector becomes a trivial class name selector.Allan
Thanks Allan. I was trying to save inline and it is working fine, but something different from what I want. I want an edit button, clicking on that, it will call ajax with new values from the row of datatable.
Datatable:
Datatable - dropdown - inline edit:
Same above code for next 2 columns
For changing values in dropdown
Could you clarify if the problem is getting the latest values from the database before, or after, the edit. If after, the server should respond with the values - there should be no need for you to go and get the values yourself.
Allan
Hi Allan,
What I get:
eg:
eg: after inline editing
ie, getting => 1 'test1' 'address1'
What I need :
eg:
have to get values => 1 'test2' 'address2'
Managed to come with screenshots here:
Table before :
http://prntscr.com/84hc32
Table at the time of editing:
http://prntscr.com/84hc8y
Table after editing:
http://prntscr.com/84hcgr
What I need :
http://prntscr.com/84hclh
I don't understand this point I'm afraid:
Editor will always submit edits to the server once the edit is complete. There is no option to queue submissions.
Thanks for the image links, but unfortunately they appear to have been removed or expired. Can you link them again please.
Allan
Allan
Hi Allan,
I want to:
edit the columns of one row - there will be a button in the row - while clicking it, that will save all modified column values in that row.
Modified the image links
Hi Allan,
help on this please.
I also tried
There is no option for this in Editor at the moment. It cannot queue edits - if you make an edit and want it to be saved, it must be submitted immediately. Since inline editing is only possible on a single cell at a time, each cell would need to be saved individually.
Allan
Thanks Allan,
Is there any method to save all details in one save button? seems that also works for me.
ie,
I have a table with four columns -
The enabled inline editing for 3rd and 4th columns. By clicking third, it will display a dropdown and by clicking 4th it will display a text field.
There is a button at the bottom of table that saves every modified data in datatable. Is there any possibility for this method?
http://prntscr.com/85y8h7
No - as I say, only a single filed can be edited inline at a time, at the moment, so they would need to be displayed and saved individually. This is something that I plan to address in a future version of Editor, but it isn't available yet I'm afraid.
Allan
Allan,
I am only using datatables, not editor plugin. And following are the handy code that I ahve used for inline editing:
I am not sure is there any other method for inline editing to make this happen.
You can use any method you want to make inline editing happen. If that one works for you, go with that. External code is not something I can offer support for.
Allan
Oh ok. Could you please help me to get all data from datatables? On clicking save button I need to get every row details (that are modified)
data()
orrows().data()
.Allan