Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82258

Problem with details.

$
0
0
Hi! I'm creating Invoices script in php + mysql (on Gnu license).
I have a problem with displaying details of invoice in "detail row". I wrote this code but it don't want to work. Is there any bugs in it?
    function fnFormatDetails ( nTr )
    {
        var aData = dTable.fnGetData( nTr );
        var id=aData[1];
         $.ajax({
            type:"POST",
            url: 'get_detail.php',
            data:'id='+id,
            success: function(msg)
            {
                dTable.fnOpen( nTr, msg, 'details' );
            }
        });
        return '';
    }
    $(function() {
    	var $dTable= $("#faktury").dataTable( {
    	        "oLanguage": {
                    "sUrl": "include/DataTables/data_polish.txt"
                }      
    	});
    	$dateControls= $("#baseDateControl").children("div").clone();
    	$("#feedbackTable_filter").prepend($dateControls);
    	$("#dateStart").keyup ( function() { $dTable.fnDraw(); } );
    	$("#dateStart").change( function() { $dTable.fnDraw(); } );
    	$("#dateEnd").keyup ( function() { $dTable.fnDraw(); } );
    	$("#dateEnd").change( function() { $dTable.fnDraw(); } );
        $('#faktury tbody td img').live('click', function () {
        var nTr = $(this).parents('tr')[0];
        if ( dTable.fnIsOpen(nTr) )
        {
            /* This row is already open - close it */
            this.src = "../examples_support/details_open.png";
            dTable.fnClose( nTr );
        }
        else
        {
            /* Open this row */
            this.src = "../examples_support/details_close.png";
            oTable.fnOpen( nTr, fnFormatDetails(dTable, nTr), 'details' );
        }
    })
    });
And the html
            <table id="faktury">                
                <thead>
                    <tr>
    				        <th>Date</th>
                                        <th>Number</th>
    					<th>Company</th>
    					<th>VAT ID</th>
                                        <th>Prize</th>
    					<th>Date of payment</th>
    					<th>Payment?</th>
                        <th></th>
                        <th></th>
                    </tr></thead><tbody>
<tr><td class=" ">01-01-2013</td>
<td class=" ">12/2013</td>
<td class=" "><a href="kontrahent.php?kontrahent=show?kid=12">Company</a></td>
<td class=" ">999-888-66-10</td>
<td class=" ">161.51</td>
<td class="unpay ">01-01-2013</td><td class="unpay ">(33) days</td>
<td class=" "><form><input class="formbutton" value="Edytuj" onclick="window.location.href='?faktury=edytuj&amp;id=56'" type="button"></form></td>
<td class=" "><form><input class="formbutton" value="Wstaw" onclick="window.location.href='?faktury=usun&amp;id=56'" type="button"></form></td></tr>

Viewing all articles
Browse latest Browse all 82258

Trending Articles