How to display the records/entries of datatable based on setting of iDisplayStart value
How to display the records/entries of datatable based on setting of iDisplayStart value
pasumarthivijaykumar
Posts: 3Questions: 0Answers: 0
i have written a sample code like as below.. [quote]My intention is that based on the value(page number) entered in the textbox and i want to set the iDisplayStart value. Could any one do please assist me on this..? When i use below code am getting an error message saying "pass no arguments or see the docs for bRetrieve and bDestroy". [/quote]
[code]
$(document).ready(function() {
/* Build the DataTable with third column using our custom sort functions */
$('#exampleTable').dataTable( {
"sDom":'<"top"l<"#table_page1">p>t<"bottom"i<"#table_page1">p>',
"aLengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
"bStateSave": true,
"iDisplayStart": 0,
"iDisplayLength": 10,
"sPaginationType": "full_numbers",
"bRetrive": true
} );
} );
$(function(){
$('#pageMover').keypress(function(event) {
if (event.keyCode == '13') {
alert('Entered');
moveToPageFunc();
}
});
function moveToPageFunc(){
var moveToPage=$("#pageMover").val();
var myTable = $('#exampleTable').dataTable();
var oSetting = myTable.fnSettings();
if(moveToPage!= null || moveToPage!= '' || moveToPage!= undefined){
alert('hi'+moveToPage);
$('#exampleTable').dataTable( {"iDisplayLength": 20});
}else{
alert('hi');
}
$(oSetting.oInstance).trigger('page', oSetting);
}
}); [/code]
Thanks.
[code]
$(document).ready(function() {
/* Build the DataTable with third column using our custom sort functions */
$('#exampleTable').dataTable( {
"sDom":'<"top"l<"#table_page1">p>t<"bottom"i<"#table_page1">p>',
"aLengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
"bStateSave": true,
"iDisplayStart": 0,
"iDisplayLength": 10,
"sPaginationType": "full_numbers",
"bRetrive": true
} );
} );
$(function(){
$('#pageMover').keypress(function(event) {
if (event.keyCode == '13') {
alert('Entered');
moveToPageFunc();
}
});
function moveToPageFunc(){
var moveToPage=$("#pageMover").val();
var myTable = $('#exampleTable').dataTable();
var oSetting = myTable.fnSettings();
if(moveToPage!= null || moveToPage!= '' || moveToPage!= undefined){
alert('hi'+moveToPage);
$('#exampleTable').dataTable( {"iDisplayLength": 20});
}else{
alert('hi');
}
$(oSetting.oInstance).trigger('page', oSetting);
}
}); [/code]
Thanks.
This discussion has been closed.
Replies
[code]
function moveToPageFunc(moveToPage, pageEntries, availablePages, totalEntriesOfReport){
var recordsStartAt;
var myTable = $('#table').dataTable();
var oSettings = myTable.fnSettings();
[quote] myTable.fnPageChange(moveToPage-1,oSettings); [/quote]
}
[/code]