Multi-row editing is not working.
Multi-row editing is not working.
I am working on python flask web application where I am having a problem with the multi-row editing, The problem is very basic ie: When I select multiple rows and they have different values, I can't see any message in the fields like 'Multiple Values'. I only see the value of the last row in the field. When I try to put a value there as I want the same value for all the rows in the column, it only updates the value of the row above the last one. Test case is below. You can press the Add Row button several times to test the multi-row editing bug. Thanks a ton!
Link to test case:
http://live.datatables.net/bewuniwu/1/edit
Debugger code (debug.datatables.net/ewoyus):
This question has an accepted answers - jump to answer
Answers
I don't see an add row button I'm afraid?
Allan
Hi @allan , if you clone it and look at the full preview, you will find the add row button!
@allan Also, you have to look at the Live Preview. For some reason the data table buttons are not showing up in the small preview screen!
How odd! It appears the JSBin runner will throw a syntax error when using a back tick template string! It is only used once in your JS - for the alert warning. Comment that out and it works.
Took me a little while to realise what was going on there, but it is due to how the rows are being added by that
Create row
button:What is happening is that the
table.row(...).data()
method gets the original data object that was added to the table. So theif
condition is modifying that object (i.e. the original), not a new copy.So you need to make a new copy in the
else
:Otherwise the data all appears the same since the same object is being used for multiple rows! Updated example here http://live.datatables.net/nagokano/1/edit .
Allan
Awesome! Cheers Allan!