Rows Disappearing On Datatables?
So let me first explain what I am trying to emulate. From the home page, there is a main table with recent table entries. The user is given a set of 'favorite' folders where they c
Solution 1:
you can use the fnAddTr plug-in http://datatables.net/plug-ins/api to add the cloned tr
$( ".dropTarget" ).droppable({
drop: function( event, ui ) {
//ui.draggable.hide();var dropped = parseInt($(this).attr('title')) + 1;
$( this ).attr('title',dropped+' entries');
var delay = $(this);
delay.prop('disabled', true).addClass('ui-state-highlight')
setTimeout(function() {
delay.prop('disabled', false).removeClass('ui-state-highlight');
}, 2000);
//return the position of the ui.draggable to appear inside the parent row
ui.draggable.css({"top":"0px","left":"0px"});
//get the tr draggedvar rowId = ui.draggable.parents("tr");
//clone rowId var cloned = rowId.clone();
//make the cloned icon draggable
cloned.find(".drag").draggable({ revert: "invalid"});
//add coned tr with fnAddTr
$(".fav1table").dataTable().fnAddTr(cloned[0]);
//delete rowId with fnDeleteRow add [0] to fix the redraw error
$(".basic").dataTable().fnDeleteRow(rowId[0]);
}
});
http://jsfiddle.net/YK5fg/7/ UPDATE now the count on $(".basic").dataTable() change when you use .fnDeleteRow() and the icon (draggable) return to the row
Post a Comment for "Rows Disappearing On Datatables?"