jquery-tabledit
jquery-tabledit copied to clipboard
Applying second time
When i reapply it on a table, cells that has selection multiplies
applying once http://i.imgur.com/rMdZuCC.png applying multiple times http://i.imgur.com/K1gy2lQ.png
How can I destroy it first?
Thanks
Hi, I can publish a patch if you're still interested. I made some changes to allow this.
Cool, thank you :)
Hello I know it's late but I have a workaround for this: For DT 1.13+, use rowCallback callback to remove previous jq tableedit changes:
$(document).ready(function () {
//...
var table = $('#example').DataTable({
// ...
"rowCallback": function (row, data) {
// my table contains three columns
var $html = $('<div id="wrapper"><table><tr id="row"><td></td><td></td><td></td></tr></table></div>');
var isTableEdit = false;
for (var i = 0; i < 3; i++) {
var $span = $('td:eq(' + i + ') span.tabledit-span', row);
if ($span.length == 0)
break;
else {
isTableEdit = true;
$html.find('td:eq(' + i + ')').text($span.text());
}
}
if (isTableEdit)
$(row).html($html.find("#row").html());
}
// ...
});
// on datatables draw event, apply your jq table edit, this approach supports both search and sort scenarios.
table.on('draw.dt', function () {
// do your table edit thing
$('#fieldsTable').Tabledit({...});
});
});
Hope this helps someone.