Deleting rows from multiple tables with jQuery

tomantford

I have a row of nested table, each with an individual ID and multiple rows. In the first table (blank0) I have the action deleteLink

$(document).ready(function(){     
   $("#blank0 .deleteLink").on("click",function() {
       var tr = $(this).closest('tr');
       tr.fadeOut(400, function(){
           tr.remove();
       });
       return false;
   }); 
});

This deletes the selected row as expected. What I want it to do is to delete the same row across all my tables. For example if I click the 3rd delete button, I would want it to delete the 3rd row on blank0 through to blank9

Bill Criswell

I'd give all the tables a common class and use the rowIndex property to filter out the <tr>s.

$('.blank').on('click', '.deleteLink', function () {
  var rowIndex = $(this).closest('tr').prop('rowIndex');
  $('.blank tr').filter(function () {
    return this.rowIndex === rowIndex;
  }).remove();
});

Here is a demo: http://jsbin.com/yugurekiri/1/edit?html,js,output

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 multiple rows from a table

From Dev

Deleting multiple rows from a table

From Dev

Deleting multiple rows from TableView

From Dev

Deleting rows from 3 tables in MySQL table

From Dev

Deleting rows from two tables related by constraint

From Dev

Querying rows from multiple tables

From Dev

Deleting multiple rows by ids and checking if those ids are not in other tables

From Dev

Deleting related rows from other tables without primary key

From Dev

Postgresql delete multiple rows from multiple tables

From Dev

Combine multiple rows from multiple tables in MySQL

From Dev

jQuery Tables, Clickable Dropdown - multiple hidden rows?

From Dev

jQuery Tables, Clickable Dropdown - multiple hidden rows?

From Dev

Deleting multiple rows in datagridview

From Dev

deleting multiple rows using check boxes with jquery in django?

From Dev

PDO deleting records from multiple tables using joins

From Dev

Delete rows from multiple tables as one query

From Dev

MySQL combine rows from multiple tables into on row

From Dev

COUNT rows from multiple joined tables - MSSQL

From Dev

Delete rows from multiple tables in a database

From Dev

Dynamic rows to columns from multiple tables with mysql

From Dev

SQL Count Rows From Multiple tables

From Dev

Find the frequency of rows from multiple joint tables

From Dev

DELETE rows from multiple tables with JOIN in Mysql

From Dev

MYSQL Select from tables based on multiple rows

From Dev

Select multiple rows from different tables

From Dev

Trigger to delete rows from related tables before deleting rows from actual table

From Dev

Python - NumPy - deleting multiple rows and columns from an array

From Dev

Trying to delete selected row from datagridview but it is deleting multiple rows

From Dev

Deleting rows of data for multiple variables

Related Related

  1. 1

    Deleting multiple rows from a table

  2. 2

    Deleting multiple rows from a table

  3. 3

    Deleting multiple rows from TableView

  4. 4

    Deleting rows from 3 tables in MySQL table

  5. 5

    Deleting rows from two tables related by constraint

  6. 6

    Querying rows from multiple tables

  7. 7

    Deleting multiple rows by ids and checking if those ids are not in other tables

  8. 8

    Deleting related rows from other tables without primary key

  9. 9

    Postgresql delete multiple rows from multiple tables

  10. 10

    Combine multiple rows from multiple tables in MySQL

  11. 11

    jQuery Tables, Clickable Dropdown - multiple hidden rows?

  12. 12

    jQuery Tables, Clickable Dropdown - multiple hidden rows?

  13. 13

    Deleting multiple rows in datagridview

  14. 14

    deleting multiple rows using check boxes with jquery in django?

  15. 15

    PDO deleting records from multiple tables using joins

  16. 16

    Delete rows from multiple tables as one query

  17. 17

    MySQL combine rows from multiple tables into on row

  18. 18

    COUNT rows from multiple joined tables - MSSQL

  19. 19

    Delete rows from multiple tables in a database

  20. 20

    Dynamic rows to columns from multiple tables with mysql

  21. 21

    SQL Count Rows From Multiple tables

  22. 22

    Find the frequency of rows from multiple joint tables

  23. 23

    DELETE rows from multiple tables with JOIN in Mysql

  24. 24

    MYSQL Select from tables based on multiple rows

  25. 25

    Select multiple rows from different tables

  26. 26

    Trigger to delete rows from related tables before deleting rows from actual table

  27. 27

    Python - NumPy - deleting multiple rows and columns from an array

  28. 28

    Trying to delete selected row from datagridview but it is deleting multiple rows

  29. 29

    Deleting rows of data for multiple variables

HotTag

Archive