DataTables logo DataTables

via Ad Packs
**PLEASE HELP** hidden row example is not drawing rows
  • DenonthDenonth
    Posts: 76
    Hi all,

    I want to use a hidden row details example. But I can't make it work. I am using "Extend" button on the same table as well. I have tried without it too but still I haven't got it to work.

    In TH everything is done correctly but in the TR there is no empty space with the icons.

    I am sending you debug code so you can see what might went wrong in my code.

    Debug link: http://debug.datatables.net/uvifax
  • DenonthDenonth
    Posts: 76
    guys any idea what might went wrong?

    This code is not working for me.
    $('#jphit tbody tr').each( function () 
    {
        this.insertBefore(  nCloneTd.cloneNode( true ), this.childNodes[0] );
    } );
    
  • DenonthDenonth
    Posts: 76
    This is my whole example:

    /* Formating function for row details */
    function fnFormatDetails ( oTable, nTr )
    {
        var aData = oTable.fnGetData( nTr );
        var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
        sOut += '<tr><td>Rendering engine:</td><td>'+aData[1]+' '+aData[4]+'</td></tr>';
        sOut += '<tr><td>Link to source:</td><td>Could provide a link here</td></tr>';
        sOut += '<tr><td>Extra info:</td><td>And any further details here (images etc)</td></tr>';
        sOut += '</table>';
         
        return sOut;
    }
    
    $(document).ready(function() {
    	
    	/*
         * Insert a 'details' column to the table
         */
        var nCloneTh = document.createElement( 'th' );
        var nCloneTd = document.createElement( 'td' );
        nCloneTd.innerHTML = '<img src="../images/details_open.png">';
        nCloneTd.className = "center";
         
        $('#jphit thead tr').each( function () {
            this.insertBefore( nCloneTh, this.childNodes[0] );
        } );
         
        $('#jphit tbody tr').each( function () {
            this.insertBefore(  nCloneTd.cloneNode( true ), this.childNodes[0] );
        } );
    	
    	var oTable=$('#jphit').dataTable( {
    			 "sDom": 'T,C<"clear">lfrtip',
    			 "oTableTools": {
    			"sSwfPath": "swf/copy_csv_xls_pdf.swf"
    		},
    			 "oColVis": {
    			 "buttonText": "Extend table",
    			"activate": "mouseover"
    		},
    		"aoColumnDefs": [ 
          { //"bVisible": false, "aTargets": [ 0 ],
    		"bSortable": false, "aTargets": [ 0 ] 	  }
        ],
    	        "aaSorting": [[1,'asc']],
    			"bProcessing": true,
    			"bServerSide": true,
    			"sPaginationType": "full_numbers",
    			"sScrollY": "350px",
    			"bDeferRender": true,
    			"sAjaxSource": "increment_table.php"
    		} );
    		
       
         
        /* Add event listener for opening and closing details
         * Note that the indicator for showing which row is open is not controlled by DataTables,
         * rather it is done here
         */
        $('#jphit tbody td img').live('click', function () {
            var nTr = $(this).parents('tr')[0];
            if ( oTable.fnIsOpen(nTr) )
            {
                /* This row is already open - close it */
                this.src = "../images/details_open.png";
                oTable.fnClose( nTr );
            }
            else
            {
                /* Open this row */
                this.src = "../images/details_close.png";
                oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
            }
        } );
    
    	} );
    
  • DenonthDenonth
    Posts: 76
    can someone check this link : http://stackoverflow.com/questions/11863053/datatables-plugin-is-not-working-when-hiding-a-details#comment15781878_11863053

    I have put pictures and so on..

    Alan I was hoping of getting your attention because I am sure that this is a simple problem to be solved.
  • DenonthDenonth
    Posts: 76
    can someone please give me some kind of idea of what to do to make it work

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion