javascript - How to get the selected rows from all pages in the data tables using Jquery -


i have data table contains list of data , want selected rows displayed in popup datatable in selected rows should displayed.

the following picture of datatable enter image description here

after selecting 2 rows datatable ,i want show them in separate popup when user clicks button

and want popup

enter image description here

in popup want display selected rows should displayed in it.

i trying these code it's not working fine me

  $("#table-sparkline").datatable().fndestroy();             var otable2 = $('#table-sparkline').datatable({                     "aasorting": []         });//popup datatable  //maintable     $("#example1 tr.selected>td").each(function() {                //alert("in nth child");                var values = $(this).html();  for(var j=i;j<values.length;j++){        otable2.fnadddata([                 values [i]                 ]);   }        }); 

popup html code:

<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="mylargemodallabel" aria-hidden="true">   <div class="modal-dialog modal-lg">     <div class="modal-content">             <div class="modal-header">                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>                 <h4 class="modal-title">tests' performance</h4>             </div>             <div class="modal-body">                 <div id="result"></div>                 <table id="table-sparkline" class="display table table-bordered num-right-alignct">     <thead>         <tr>             <th>testname</th>             <th>oct-2014</th>              <th>nov-2014</th>               <th>dec-2014</th>                <th>jan-2014</th>                 <th>feb-2014</th>                  <th>mar-2014</th>          </tr>     </thead>     <tbody id="tbody-sparkline">  </tbody>                 </table>             </div>      </div>   </div> </div> 

var tablevalues =[];      $("#table-sparkline").datatable().fndestroy();       var otable2 = $('#table-sparkline').datatable({                 "aasorting": []     });     otable2.fncleartable();                 //alert("in nth child");                //var values = $(this).html();                        //alert(values);         var table = $('#example1').datatable();          tablevalues.length=0;         tablevalues=(table.rows('.selected').data());         for(var i=0;i<tablevalues.length;i++){          otable2.fnadddata([                 tablevalues[i]                 ]);           } 

Comments