fnGetData for invisible rows
fnGetData for invisible rows
Hi Allan,
Need your help in figuring out below datatable situation.
I need to get data for 10 rows at a time from the datatable and display certain fields from those rows on page
When user clicks my next button , need to get data for next 10 rows. Im using fnGetData as
for( i=0 ; i< 10 ; i++)
{
var aData = oTable.fnGetData(i);
$('#txtfield1').append(aData[0]);
}
Works fine for 10 rows as datatable is displaying 10 rows, fails afterwards.
User will NOT be clicking DATATABLE to display next 10 rows , so how should I get the next 10 invisible rows
as many times as user clicks on next button.
Cannot use var oTable.fnGetPosition(i) along with fnGetData , as user will not be clicking on DATATABLE itself.
Will appreciate any pointers....
thx
Need your help in figuring out below datatable situation.
I need to get data for 10 rows at a time from the datatable and display certain fields from those rows on page
When user clicks my next button , need to get data for next 10 rows. Im using fnGetData as
for( i=0 ; i< 10 ; i++)
{
var aData = oTable.fnGetData(i);
$('#txtfield1').append(aData[0]);
}
Works fine for 10 rows as datatable is displaying 10 rows, fails afterwards.
User will NOT be clicking DATATABLE to display next 10 rows , so how should I get the next 10 invisible rows
as many times as user clicks on next button.
Cannot use var oTable.fnGetPosition(i) along with fnGetData , as user will not be clicking on DATATABLE itself.
Will appreciate any pointers....
thx
This discussion has been closed.
Replies
Allan
aData=oTable.fnGetData();
$(aData).each(function() {
var nextRow = new Array();
aReturn.push( nextRow );
});
alert ( "Table row count " + aReturn.length);
And it display row count as 10 ( although table has total of 300 rows, with 10 displayed)
I am using Datatables 1.8.2
Is there something that I am missing
Allan
"bServerSide": true,
"sAjaxSource": "myproj/ws/getData"
so should I not use "bServerSide" and use $.ajax( { to get data for the table
$('#filter').live('click', function() {
getData();
}
function getData (){
var jqxhr=$.getJSON('/myproj/ws/getData?', function(json) { })
.success(function(jsondata) {
alert('retrieved check data');
reloadDataTables(jsondata)
})
.error(function() {
alert('unable to retrive data');
})
.complete(function(json) {
});
}
function reloadDataTable(jsondata) {
oTable = $('#checkItems').dataTable( {
"bProcessing": true,
"aaData": jsondata.aaData,
});
}
But I m getting "Object expected jQuery.js line 16 character 15511
jQuery.js is jQuery JavaScript Library v1.6.2
Im using Datatable 1.8.2
Once again any pointer will help.. thx
Need your help in figuring this out,
I did not want to do fnGetData() ( without args) and traverse through ALL the table rows so I tried something as listed below
oTable = $('#myTable').dataTable( {
"aaData": myaaData, // myyaaData is rec from server through getJSON call
"bProcessing": true,
"aLengthMenu": [10, 25, 50, 100, 250],
"sPaginationType": "full_numbers",
"aoColumnDefs": [{"bSortable": true, "bSearchable": true, "aTargets": [0]},
{"sClass": "dt-number dst-currency dst-USD numeric-comma", "aTargets": [5]},
{"sClass": "dt-datetime dst-date", "aTargets": [6]},
});
so bServerSide = false,
now if I try to get row data as below, for row that is NOT currently visible on the table as below,
rowindex = oTable.fnGetPosition( $("#myId").get(0) ) ;
aData=oTable.fnGetData(rowindex);
I am getting ==> 'nodeName' is null or not an object
Could you please point me in the right direction.
Thanks for your help.