How to append “<tr>” data of one table to another data table

Let us consider a data table in a page where we have to append the selected tr data which is present in another table
So lets consider a page with two tables 
1. pageTable
2. modelTable

“pageTable” is present in html page where as “modelTable” is present in model
By simple code using jquery we can append selected tr data from one table to another as follows


In the above code on click on tr we will append the tr to another table 
Rows in line one identifies the table-tbody-tr,  on click on particular 
line 6 identify the selected row
line 7 clones the selected tr by using
row.clone
Line 10 copies the cloned row to table we want
In this way using clone and append we can achieve our task.

Full example can be see in jsfiddle Link

No comments:

Post a Comment