fnopen problem

fnopen problem

gungnirgungnir Posts: 6Questions: 0Answers: 0
edited August 2012 in General
[code] oTable = $(".dataTable").dataTable({
"fnDrawCallback": function (oSettings) {
this.fnOpen(this, "some text", 'details');
}
});[/code]

this didnt work too

Replies

  • gungnirgungnir Posts: 6Questions: 0Answers: 0
    i solved it myself . maybe this code helps someone. this code works on even if you change page or use fnDraw .here it is:
    [code] var myinput;
    var listselected = new Array();
    var nTrs;
    var oTable=$('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "siparisler_serversidesorter.php",
    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
    if(jQuery.inArray(aData[1],listselected) > -1) {
    $(nRow).attr('id','acik');
    }
    return nRow;
    },
    "fnDrawCallback": function( oSettings ) {
    nTrs = $("#example tbody tr");
    thisTable = $('#example').dataTable();
    nTrs.each(function() {
    myinput=$(this).attr('id');
    if(myinput=='acik'){
    $(this).find('.opendetails').attr("src","../images/details_close.png");
    thisTable.fnOpen( this,you can use text or go to a function(),"details" );
    }
    })
    }
    });

    $('#example tbody td').find('.opendetails').live( 'click', function () {
    var nTr = $(this).parents('tr')[0];
    var rowsdata=oTable.fnGetData( nTr );
    if ( oTable.fnIsOpen(nTr) )
    {
    /* This row is already open - close it */
    this.src = "../images/details_open.png";
    listselected.splice( $.inArray(rowsdata[1],listselected) ,1 );
    oTable.fnClose( nTr );
    }
    else
    {
    /* Open this row */
    this.src = "../images/details_close.png";
    listselected.push(rowsdata[1]);
    oTable.fnOpen( nTr,"you can use text or go to a function()",'details');
    }
    } );

    [/code]
This discussion has been closed.