Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8902321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:35:00+00:00 2026-06-15T01:35:00+00:00

I have a table using the datatable plugin. I am trying to remove a

  • 0

I have a table using the datatable plugin. I am trying to remove a row from it dynamically using this:

$(document).ready(function() {

    var oTable = $("table#demo-dtable-02").dataTable({"aaSorting": []});

    $(".icon-remove").on('click',function(){
        var anSelected = fnGetSelected( oTable );
        deleted=oTable.fnDeleteRow(anSelected[0] );
      });

              });

I get the following error ReferenceError: fnGetSelected is not defined
I tried using (from here: jQuery Data Tables plugin not removing table row)

$(this).parent('tr').remove();

This would of course remove the row but will not reset the text in the footer like
Showing 1 to 10 of 17 entries.
Removing this way is not the best solution to this.

My DOM Code looks like:

<?PHP
                                            $count=1;
foreach($ledgers as $row) {?>
    <tr >
    <td><a onClick="viewDetails(<?PHP echo $row['id'];?>)" style="cursor:pointer"><?PHP echo $row['name'];?></a></td>

     <td><?PHP echo $row['email'];?></td>
     <td><?PHP echo $row['contact_number'];?></td>

     <td>
     <i class="icon-remove" rowcount=<?PHP echo $count;?> style="cursor:pointer; margin-right:5px" title="Remove Ledger" id="removeLedgerNow"></i>

    <i class="icon-edit" style="cursor:pointer" title="Edit Ledger" onclick="viewDetails(<?PHP echo $row['id'];?>)"></i>

   </td>
  </tr>
   <?PHP $count++; } ?>

Comment.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:35:02+00:00Added an answer on June 15, 2026 at 1:35 am

    Updated:

    Try this code:

     $('.icon-remove').on('click', function () {
       // Get the position of the current data from the node
       var aPos = oTable.fnGetPosition( $(this).closest('tr').get(0) );
       // Delete the row
       oTable.fnDeleteRow(aPos);
     } );
    

    Notes:

    1. There is no fnGetSelected in the API. It could be a custom function the OP has, but is not produced in the question.
    2. fnGetPosition is accepts td, th, or tr element
    3. .get(0) is to break the element out of the jQuery object
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this jquery datatable plugin to display information from database. My table
i have a problem,,i try to make a table using datatable...i've been download from
I have a column with buttons in a table I'm using jQuery datatable plugin.
Using this example: http://www.w3schools.com/php/php_ajax_database.asp I have set up a table echoing from database. I
I have a database table using an enum. This is already working with hibernate
I have a table like this (using wordpress) +---------+----------+------------+ | meta_id | meta_key |
I have a stored procedure that updates a table using linq, eg: (this is
I am using the jquery datatable plugin. I have the following code that sets
I'm trying to add a jQuery dialog in each row of a table, using
I am using jQuery Datatable plugin for rendering a table as jQuery DataTable. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.