Deleting a Row in a rowReorder Table Resets Reordering

Chakron

Here's a jsfiddle to show what I'm talking about:

https://jsfiddle.net/ChakronSA/sdwfcrmr/

You can click and drag on either the "Order" or "Name" columns. To recreate this issue: 1. Drag "Name 4" to the top so it's above "Name 1" 2. Click the Delete button next to "Name 2"

When deleting "Name 2", "Name 4" returns to its original position. How can I make it stay put? I feel like I'm missing something obvious. Thanks.

Specifically curious about why this isn't doing what I expect:

$(document).on("click", ".myTableDeleteRow", function() {
  table
    .row($(this).parents('tr'))
    .remove()
    .rows().every(function(rowidx) {
    var data = this.data();
    data[0] = rowidx + 1;
    this.data(data);
    })
    .draw(false);
});
Jose Rodrigues

Heres a fix not using just tableData

$(document).on("click", ".myTableDeleteRow", function() {
  table
   .row($(this).parents('tr'))
   .remove()
   .draw(false);

  $.each($('#myTable tr td:first-child'),function(index,val){
    $(this).html(index+1)
  });
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

deleting a row from table

From Dev

Deleting row in Sqlite table

From Dev

deleting a row in a table

From Dev

Display of up/down buttons in table row reordering

From Dev

Deleting table row by id with jQuery

From Dev

Deleting Row in table using jQuery

From Dev

UITableView deleting row reduced table row height

From Dev

RowReorder extension does not save position of the row

From Dev

VBA deleting Hyperlinks Resets Formatting

From Dev

Deleting row in table with Jquery in mvc project

From Dev

404 Error When Deleting Table Row in Azure

From Dev

"On Delete Cascade" if deleting a row from the child table

From Dev

Deleting rows and insert row in pivot table laravel

From Dev

Deleting Row from users table PHP MYSQL

From Dev

Always deleting last row of table in MVC View

From Dev

Deleting a row from an HTML table in javascript

From Dev

AJAX/Jquery not deleting row from MySQL table

From Dev

Deleting row in table with Jquery in mvc project

From Dev

renumber appended table row in javascript after deleting

From Dev

Deleting a row inside a table - AngularJS and FireBase

From Dev

Deleting a table view row with Swift 3 and CoreData

From Dev

How to check existing row before deleting row in another table?

From Dev

Yii 1 - deleting row after saving row in other table

From Dev

DataTables row moving behind bootstrap modal using RowReorder

From Dev

SQL locks parent table while deleting child table row

From Dev

MySql - Reordering the rows of a table

From Dev

Excel - reordering table

From Dev

In Angularjs, how to update table data after deleting a row from it

From Dev

Having issue deleting a html table row using jquery dataTable

Related Related

HotTag

Archive