Forum
Topic RSS
13:32
21/10/2009
OfflineWith paging enabled, if I jump to page 3 and then change the sort order by clicking a column, the sorting changes and I am sent back to page 1. Is there a way to retain the page that I am on when the sort order changes? In other words, when I am on page 3 and I change the sort order, I'd like to stay on page 3.
Thanks.
11:42
Moderators
30/10/2007
OfflineHello,
Look at onSortCol event. It will do the job.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
10:36
21/10/2009
OfflineOK - I can set the page within onSortCol and the list jumps to that page after sorting:
onSortCol: function(index,iCol,sort){jQuery("#list").setGridParam({page:3});
However, I obviously don't want to hard-code the page number... and instead it should be set depending on what page I'm on when I click the column to sort by. How can I fetch the current page in order to set it in the setGridParam above? When I call $('#list').getGridParam('page') from within the onSortCol function, it returns "1" even if I'm on page 5.
11:11
Moderators
08/10/2009
OfflineYes, the page the grid is currently on is accessible in the property (option, in jQuery UI terms) "page". To access it, use something like that
var grid = $("#myGridID");
var page = grid.getGridParam('page')
then pass the page variable on with the sort events.
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
13:11
21/10/2009
OfflineRight... I had tried that. See my last post:
"When I call $('#list').getGridParam('page') from within the onSortCol function, it returns “1″ even if I'm on page 5."
I tested this by simply placing an alert($('#list').getGridParam('page')) inside the onSortCol function. If I'm on, for example, page 5 and click a column to change the sort, the alert box displays "1", instead of "5" like I would have thought. Any idea why or what I could try different?
13:16
21/10/2009
OfflineI suppose that I could keep track of the page number by creating a variable for currentPage and then doing something like:
onPaging: function() { currentPage = $('#list').getGridParam('page'); },
onSortCol: function() { jQuery('#list').setGridParam({page:currentPage});
But is there a cleaner way??
03:58
Moderators
30/10/2007
OfflineHello,
The solution is a little bit tricky.
onSortCol: function(index,iCol,sort){
var postpage = jQuery(”#list”).getGridParam('postData');
jQuery(”#list”).setGridParam({page:postpage.page});
}
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
09:21
yeah it stayed at the current page but the data.. but it sorts all the data not the data within the selected page. is there any way to sort the data in the selected page?
for instance i have an alphabet table:
im in page 2 and the data in the table are-
p
s
t
r
and i want to sort those data and it would be like:
p
r
s
t
not like:
a
b
c
d
or
w
x
y
z
Most Users Ever Online: 994
Currently Online:
20 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66
Log In
Home