I am using a jQuery datatable plugin to display a table in a jquery user interface dialog. Below is the function that I call to draw the table.
function listPtCharges(filter){
var chgTable;
chgTable =
$('#chargeTable').dataTable({
"bJQueryUI": true,
"bDestroy": true,
"sDom": 'tT',
"bSort": false,
"bAutoWidth": false,
"sAjaxSource": "/ajax/ptchglist.php",
"sAjaxDataProp": "Records",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "acctno", "value": $("#curAcctno").val() } );
aoData.push( { "name": "ins_id", "value": $("#ins_id").val() } );
aoData.push( { "name": "filter", "value": filter } );
$.ajax( {
"dataType" : 'json',
"type" : "POST",
"url" : sSource,
"data" : aoData,
"success" : fnCallback
} );
} ,
"aoColumns":
[
{"bVisible":false},
{"sWidth": 55},
{"sWidth": 30},
{"sWidth": 40},
{"sWidth": 125},
{"sWidth": 50},
{"sWidth": 50},
{"sWidth": 20},
{"bVisible":false}
],
"oTableTools": {
"sRowSelect": chgSelctionTyp,
"sSwfPath": "/swf/copy_csv_xls_pdf.swf",
"aButtons": []
}
});
}
This function is called immediately after the call to open a dialog. Here are the lines of code that open the dialog box and then load the table.
var oTT = TableTools.fnGetInstance( 'chargeTable' );
if(oTT)
oTT.fnSelectNone();
$( "#chargeList" ).dialog( "open" );
listPtCharges();
In the dialog box, I have another button with an event handler with a filter value and calling the same function with a new filter. A newly loaded table always displays more rows on the server.
Everything is fine, except for a strange problem. Whenever a new table is created with a large number of rows, only the number of rows equal to the previous table can be selected.
, 5 , , . 8 . 5 . firebug, .
.
EDIT:
, .
var oTT = TableTools.fnGetInstance( 'chargeTable' );
var aData = oTT.fnGetSelectedData();
jquery datatables, firebug.
"fnIsSelected": function ( n )
{
var pos = this.s.dt.oInstance.fnGetPosition( n );
return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false;
},
.
TypeError: this.s.tt.aoData [pos] - undefined
, aodata - , , .