fnDeleteRow error: k is undefined

fnDeleteRow error: k is undefined

tampe125tampe125 Posts: 7Questions: 1Answers: 0
edited August 2011 in DataTables 1.8
hi, i have just started using your plugin and it's very amazing!
sadly i have an error that i can't fix :(

when i try to delete a row a get a firebug error "k is undefined".
this is my code, as i pasted from your examples:

[code]
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();

for ( var i=0 ; i

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    is fnGetSelected returning an empty array? check if anSelected[0] is undefined
  • tampe125tampe125 Posts: 7Questions: 1Answers: 0
    ehm... now it's working.
    and i didn't touch anything...

    ops! sorry for bothering you :)
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited August 2011
    if you have nothing selected, you will probably have errors again. you should check to make sure that anSelected[0] is defined before calling fnDeleteRow

    [code]
    if (anSelected[0]) dataTable.fnDeleteRow( anSelected[0] );
    [/code]
  • Eric_DeCoffEric_DeCoff Posts: 8Questions: 0Answers: 0
    edited February 2012
    Think you could have done it with a bit more clarity with

    [code]
    fnOnDeleting: function (tr, id, fnDeleteRow) {

    // The following returns an array of td from
    var nTD = $('#example tr.row_selected td')

    // Primary Key other then first column
    var removeID = nTD[1].innerHTML;

    jConfirm('Please confirm that you want to delete row with id ' + removeID,
    'Confirm Delete', function (r) {
    if (r) {
    fnDeleteRow(removeID);
    oTable.fnReloadAjax(oTable.fnSettings());
    return true;
    }
    });
    return false;
    }

    [/code]
This discussion has been closed.