Quote: $('#reloadID').click(function () { var prevSelection = ""; var tr = $(this).closest('tr'); var rowsSelected = table.rows('.selected').data(); var complete = table.rows().data(); //var nonselected = table.row(tr).node().className; //var test = $("#mytbl").dataTable().fnGetNodes().className; // console.log(nonselected); var mcb = '<th/>'; var vendorsTable = '<table id="mytbl"> <thead> <tr>' + mcb + '<th>xyz</th> <th>zy</th> <th>xyz</th> <th>xy</th>'; vendorsTable = vendorsTable + '<th>City</th> <th>State</th> <th>Zip</th> </tr> </thead> <tbody>'; $.each(rowsSelected, function () { var $this1 = this; if ($this1[2] + "," + "," != prevSelection) { var selected = ""; var ccb = '<td/>'; vendorsTable = vendorsTable + '<tr class="">' + ccb + '<td>' + $this1[1] + '</td> <td>' + $this1[2] + '</td> <td>' + $this1[3] + '</td> <td>' + $this1[4] + '</td>' + '<td>' + $this1[5] + '</td> <td>' + $this1[6] + '</td> <td>' + $this1[7] + '</td>' + '</tr>'; prevSelection = $this1[2] + "," + ","; } }); vendorsTable = vendorsTable + '</tbody> </table>'; $('#Vendors').empty(); $('#Vendors').append(vendorsTable); //Initialize the table generated with datatable plug-in table = $('#mytbl').DataTable({ "oLanguage": { "sSearch": "" }, columnDefs: [{ orderable: true, className: 'select-checkbox', targets: 0 }], select: { style: 'multi', selector: 'td:first-child' }, dom: 'T<"clear">lfrtip', tableTools: { "sRowSelect": "multi", "aButtons": ["select_all", "select_none", { "sExtends": "select_all", "sButtonText": "Select Filtered", "fnClick": function (nButton, oConfig, oFlash) { var oTT = TableTools.fnGetInstance('mytbl'); //remove previous selections oTT.fnSelectNone(); oTT.fnSelectAll(true); //True = Select only filtered rows (true). Optional - default false. } }, { "sExtends": "select_none", "sButtonText": "Deselect Filtered", "fnClick": function (nButton, oConfig, oFlash) { var oTT = TableTools.fnGetInstance('mytbl'); //remove previous selections oTT.fnSelectNone(true); } } ] }, order: [1, 'asc'] } }); } });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)