Adding and Removing a row indirectly from secondary table
Adding and Removing a row indirectly from secondary table
Sageis1
Posts: 53Questions: 9Answers: 0
Currently I have two tables, table 1 contains all the data, table 2 is empty, what i want is a toggle like functionality.
If i check a checkbox, it added the checked row to the new table, if i uncheck it it removes that row from the new table.
Currently I am able to get the data needed to add to the new table, I'm just not sure how to do that.
Here is the test case: http://live.datatables.net/weluyanu/47/edit
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Use
row.add()
to add the row. Userow().remove()
to remove the row. Use therow-selector
as a function to select only the rows that match the name.Kevin
@kthorngren im having issues just getting the complete data into the table, also im not sure on the logic part of removing and adding a table.
Here the test case: http://live.datatables.net/weluyanu/48/edit
The
row.add()
docs state this:You are adding a string. You need to place your column data in an array. Something like this:
Kevin
@kthorngren Im just having issue distinguishing a check and a uncheck, do you have any idea on what to do with this
Here is the test case: http://live.datatables.net/weluyanu/49/edit
Look at this example from your other thread.
Kevin
@kthorngren, Im still having issue getting the actual data from the change event,
Here is the test case: http://live.datatables.net/lulaluye/11/edit
Also when removing the row with table.row.remove(?).draw(), for the question mark do i have to pass the data ive gotten or the row.
You commented out this line:
This is needed to get the row that the clicked checkbox is on. In the function
this
is the checkbox not the row.This should look like this
table.row().remove().draw()
. Note therow()
.Kevin
@kthorngren, How do i access the values on the row
Im still having issue getting the data : http://live.datatables.net/lulaluye/13/edit
You need to pass the node of the row into
row()
, like this:See updated example here: http://live.datatables.net/lulaluye/13/edit
Colin