Row details + multiple tables, a combination without future?

Row details + multiple tables, a combination without future?

LuysLuys Posts: 15Questions: 0Answers: 0
edited March 2012 in General
Hi all!

Anyone know and can tell me how to combine the examples of these two pages?

http://www.datatables.net/release-datatables/examples/api/row_details.html
http://www.datatables.net/release-datatables/examples/basic_init/multiple_tables.html

That is, how to start all the row details in a multiple tables page at once?

Thanks in advance for your answers!

Luys

P.S.: Obviously I try again and again without success...

Replies

  • asmaasma Posts: 2Questions: 0Answers: 0
    You should have a counter for your table in the id for all your table and in the details click function
    you should affect the coutner to $.fn.dataTableExt.iApiIndex
    like this :
    $.fn.dataTableExt.iApiIndex =$(this).parents('table').attr('id');
    $.fn.dataTableExt.iApiIndex =////0 or 1 or 2
  • thydathyda Posts: 2Questions: 0Answers: 0
    Hi, I can help you.
  • thydathyda Posts: 2Questions: 0Answers: 0
    edited September 2012
    Step 1:

    change $(#example .....) to $(.dataTable.......) in head tag

    step 2:

    change

    $('.dataTable thead tr').each( function () {
    this.insertBefore( nCloneTh, this.childNodes[0] );
    } );

    to
    $('.dataTable thead tr').each( function () {

    this.insertBefore( nCloneTh.cloneNode(true), this.childNodes[0] );
    } );

    Step 3:

    $('.dataTable tbody td img').live('click', function () {


    /***********************************************
    *******************MY EDIT*********************
    ***********************************************/
    var nTr = $(this).parents('tr')[0];
    var nTt = $(this).parents('table')[0];
    var oTable = $(nTt).dataTable();
    /*
    ***********************************************
    */
    if ( oTable.fnIsOpen(nTr) )
    {
    /* This row is already open - close it */
    var file = this.src.split("/");
    if(file[file.length-1] == 'details_close.png')
    this.src = "asset/images/details_open.png";
    oTable.fnClose( nTr );
    }
    else
    {
    /* Open this row */
    var file = this.src.split("/");
    if(file[file.length-1] == 'details_open.png')
    this.src = "asset/images/details_close.png";
    oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );




    step4:
    Note: You must have file:

    assets/images/.....+details_open.png +details_close.png
    assets/js/jquery.js and jquery.dataTable.js
    assets/css/demo_page.css and demo_table.css




    }
    } );
  • LuysLuys Posts: 15Questions: 0Answers: 0
    Thank you for your help!
    I will try as soon as possible.

    Luys
This discussion has been closed.