Problem with details.
Problem with details.
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?
[code] 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' );
}
})
});[/code]
And the html
[code]
Date
Number
Company
VAT ID
Prize
Date of payment
Payment?
01-01-2013
12/2013
Company
999-888-66-10
161.51
01-01-2013(33) days
[/code]
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?
[code] 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' );
}
})
});[/code]
And the html
[code]
Date
Number
Company
VAT ID
Prize
Date of payment
Payment?
01-01-2013
12/2013
Company
999-888-66-10
161.51
01-01-2013(33) days
[/code]
This discussion has been closed.