fnDeleteRow() problem - bug or usage problem ?

fnDeleteRow() problem - bug or usage problem ?

EranEran Posts: 26Questions: 0Answers: 0
edited December 2012 in DataTables 1.9
Hello Allan & fellow forum members,

I've encountered a strange problem using fnDeleteRow and decided to seek here some advice...
When I've tried using fnDeleteRow( [ TR element] ) to delete a certain row, the NEXT row was being deleted to the one I was actually passing as a parameter.

Then, I've decided to try and use an index parameter instead just to see what happens....
For example: fnDeleteRow(0).
What I found was that the second row (which is supposed to be index 1) was being deleted instead of the first row (index 0).

In general, fnDeleteRow was working with an +1 offset - deleting the next row which I didn't want to delete instead of the previous one.
It's like the rows index starts from the second row instead from the first row.

I have no idea what's causing this strange behavior. Bug? Usage problem?
Any ideas ?

Replies

  • girishmrgirishmr Posts: 137Questions: 0Answers: 0
    Please provide a test case without which it will be difficult if not impossible to get a solution. You can use either jsfiddle.net or live.datatables.net to post your testcase.
  • EranEran Posts: 26Questions: 0Answers: 0
    Hi,
    Providing a test case is problematic for me since the computer I'm using for development isn't connected to the Internet.

    I've tried deleting the row element using .remove() and it worked as a charm (for the UI anyway).
    So I know for sure I'm passing the right TR element but something goes terribly wrong with the transition from the TRDataTableElement to an index...
  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    `remove` is a jQuery method. Are you making sure you are passing the node and not a jQuery object?
  • EranEran Posts: 26Questions: 0Answers: 0
    edited December 2012
    Wow. You are totally right.........................
    I was passing a JQuery object instead of a DOM node without realizing I'm doing something wrong.
    I thought the the API could take a JQuery object as well....

    That was definitely a usage problem.
    Problem solved.

    Thank you :)
  • EranEran Posts: 26Questions: 0Answers: 0
    P.S.

    I've noticed that JQuery compatibility is coming in version 1.10. :)

    Personally, I'd love to see Backbone js support as well.... maybe even as a feature plugin ?
This discussion has been closed.