fnOpen problem

fnOpen problem

le_shataile_shatai Posts: 7Questions: 0Answers: 0
edited October 2011 in General
Hi

I cannot insert details row, that are retrieved via an ajax call.
If I try to insert directly (for testing purposes) this also fails.

So I am not sure whether this is a bug in my implementation,
or whatever. Can anybody help me, or give any hint what's wrong ?

Regards


[code]
// 'datatables' is an array of DataTable object, as I have several independent
// tables on my page
jQuery(target+ ' table.searchable a[data-role="details"]').live('click',

function(){

var tableId = jQuery(this).parent().parent().parent().parent().attr('id')

var row = jQuery(this).parent().parent();

for( var i=0;i

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    I haven't had a chance to sort through it very deeply yet, but just to get you started, I would bulletproof my DOM traversal a bit more. Instead of going .parent().parent() (etc), you could just use "closest".

    So where the clicked element is an anchor as selected by "data-role='details'", and you want to find the row it's in, just use jQuery(this).closest('tr'). If you want to find the table's ID, jQuery(this).closest('table').attr('id').
  • le_shataile_shatai Posts: 7Questions: 0Answers: 0
    Hi GregP

    I proved the selected row and the selected table via console.log(...) .
    So every function gets it correct parameters. But I'll check that again.
    Tnx so far...
  • le_shataile_shatai Posts: 7Questions: 0Answers: 0
    edited October 2011
    Hi

    I solved this issue.
    If one is interested in the solution has a look at the code following.

    [code]
    // 'datatables' is an array of DataTable object, as I have several independent
    // tables on my page
    jQuery(target+ ' table.searchable a[data-role="details"]').live('click',

    function(){

    var tableId = jQuery(this).parent().parent().parent().parent().attr('id')
    // THIS HAS BEEN THE EVIL LINE
    //
    // var row = jQuery(this).parent().parent();
    //
    // HAS TO BE
    // var row = jQuery(this).parentNode.parentNode;
    //
    // else jQuery.inArray(nTr, nTrs) in _fnOpen() fails
    // as nTr is an object, but nTrs is a plain array
    var row = jQuery(this).parentNode.parentNode;

    for( var i=0;i
This discussion has been closed.