Datatables - change row, then move to another table
Datatables - change row, then move to another table
Cezarr
Posts: 8Questions: 3Answers: 1
I'd like to click the button, send Ajax request and if it is success then I'd like to show/hide buttons and move row to another table. Everything works with moving rows, but previously hidden/shown buttons goes back to it's hidden/not-hidden state. Also buttons don't react on clicking on them. Where is the problem?
Here is the example (without Ajax, but still not working as I want it to work)
This discussion has been closed.
Replies
Looks like you are running into the problem of needing jQuery delegated events as discussed in this FAQ.
Kevin
What about buttons which should be hidden/displayed but they're not after moving row?
Hi Cezarr,
The way you are currently trying to move the buttons will not work as adding a row using
row.add(addRow.data())
will make a new row based on the data it is given rather than adding that exact row.One way to make the buttons work is to set the
columnDef
for that column to have adefaultContent
of a button element. Making this a deactivate button in your active table and an activate button in your unactive table will mean that when you move a row the right button will always be created. You will also need to create a jQuery event for when the button is pressed.I've edited your example to show this working, it can be found here.
Hope this helps,
Sandy
I did it in some other way, but now look at values you're changing and then deactivating/activating row. The value goes back to previous one, not the one I wrote in input.
Hi Cezarr,
Sorry I did not realise you wanted the data in the text boxes to be consistent across the change.
It is possible to do this by moving the nodes instead, have a look at this example.
Hope that helps,
Sandy
That is the best solution, thank you Sandy