Issue with fnStandingRedraw - unable to select any table row after calling it

Issue with fnStandingRedraw - unable to select any table row after calling it

seanburke13seanburke13 Posts: 3Questions: 0Answers: 0
edited January 2014 in General
[code]
theRecordID = $("#form_theRecordID").val();
oTableLocal = $('#theTable').dataTable();
oTableLocal.fnStandingRedraw();

var aTrs = oTableLocal.fnGetNodes();
for ( var i=0 ; i

Replies

  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    I think we'd need to see a test case of this so I can debug what is going wrong - it isn't immediately clear as the code above looks okay.

    Allan
  • seanburke13seanburke13 Posts: 3Questions: 0Answers: 0
    That will be challenging, but I'll see what I can do. Thanks for your help, and great product!
  • seanburke13seanburke13 Posts: 3Questions: 0Answers: 0
    I found a work-around, not sure if it is an inspired solution or a miserable hack. I did some additional debugging and found that my javascript was executing as expected, but when it was done the row lost the class I had just added. I moved this part of the code -

    [code]
    var aTrs = oTableLocal.fnGetNodes();
    for ( var i=0 ; i
  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    Ah - are you using server-side processing? In which case yes, fnStandingRedraw will execute and return before the new data has been loaded. You could use the `draw` event to cope with that:

    [code]
    $('#myTable').one( 'draw.dt', function () {
    // ... add classes etc
    } );

    oTableLocal.fnStandingRedraw();
    [/code]

    then the event handler will fire on the next draw (i.e. when the data has loaded).

    Allan
This discussion has been closed.