Resetting the page number
Resetting the page number
manil22
Posts: 6Questions: 0Answers: 0
Hi,
After displaying the search resluts, I'm doing the pagination. For example, if I went to second page and modifying my search criteria which will display only limited results (only first page is sufficient to display the results now). In this case it is showing me the second page which is not having any records. (It's holding the previous page number) And I have to click the 'Previous' button to see the results.
I'm trying to reset the 'iDisplayStart' value, which is not working for me. Is there any way to reset this value? My code looks like below.
[code] $(document).ready(function(){
$('#markAllComplete').click(confirmMarkAll);
$('.ajaxDatatable').dataTable( {
"iDisplayStart": 0,
"bProcessing": true,
"bServerSide": true,
"bStateSave": true,
"sAjaxSource": "${ajaxSource}",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.getJSON(sSource, aoData,
function(data, textStatus, xhr){
fnCallback(data, textStatus, xhr);
applyAlternatingTableRowClasses(); // alt-default.js
});
}
} );
$('.dataTables_length select').append(
'500'
+ '1000').val(
"${criteria.dataTableListSize}").change(function() {
$.ajax({
url : "${ajaxUpdateListSize}",
data: "dataTableListSize=" + $("select option:selected").text(),
success : function() {
$(this).addClass("done");
}
});
});
$('.dataTables_filter input').val('').keyup();
}); [/code]
After displaying the search resluts, I'm doing the pagination. For example, if I went to second page and modifying my search criteria which will display only limited results (only first page is sufficient to display the results now). In this case it is showing me the second page which is not having any records. (It's holding the previous page number) And I have to click the 'Previous' button to see the results.
I'm trying to reset the 'iDisplayStart' value, which is not working for me. Is there any way to reset this value? My code looks like below.
[code] $(document).ready(function(){
$('#markAllComplete').click(confirmMarkAll);
$('.ajaxDatatable').dataTable( {
"iDisplayStart": 0,
"bProcessing": true,
"bServerSide": true,
"bStateSave": true,
"sAjaxSource": "${ajaxSource}",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.getJSON(sSource, aoData,
function(data, textStatus, xhr){
fnCallback(data, textStatus, xhr);
applyAlternatingTableRowClasses(); // alt-default.js
});
}
} );
$('.dataTables_length select').append(
'500'
+ '1000').val(
"${criteria.dataTableListSize}").change(function() {
$.ajax({
url : "${ajaxUpdateListSize}",
data: "dataTableListSize=" + $("select option:selected").text(),
success : function() {
$(this).addClass("done");
}
});
});
$('.dataTables_filter input').val('').keyup();
}); [/code]
This discussion has been closed.
Replies