Problems Sort, Length
Problems Sort, Length
japaphr
Posts: 6Questions: 0Answers: 0
Hi,
I don't know if anyone has the same problem, but,
1- when you use filter and sort a column, after the sort the list return to page 1. Without the filter after the sort stays in the right active page.
2 - When you use Length, if you are not in the first page, and change the length rows from 10 to 20 for example, always lower length to higher , then the button next doesn't work(using paginate full members) and the rows order are wrong.
Thanks ....
I don't know if anyone has the same problem, but,
1- when you use filter and sort a column, after the sort the list return to page 1. Without the filter after the sort stays in the right active page.
2 - When you use Length, if you are not in the first page, and change the length rows from 10 to 20 for example, always lower length to higher , then the button next doesn't work(using paginate full members) and the rows order are wrong.
Thanks ....
This discussion has been closed.
Replies
1. This is by design. The reason for it is that if you sort, then generally you would expect to go to the start of the sort, rather than some random point in the middle. You can get around this by using fnDisplayRow() and saving the display point just before the click: http://datatables.net/forums/comments.php?DiscussionID=391 - this thread is relevant, but as I say, this is a 'feature, not a bug' ;-)
2. Interesting - seems to work for me on this example: http://datatables.net/examples/example_alt_pagination.html - does it also work in your browser?
Thanks,
Allan
1 - Thanks, I it's clear ...
2 - Hum, Well, Try these:
- Go to page 2, check the first row, change length to 25, after the change the first row remains, is this right?
- The sort returns to first page, OK ... If you press next it works and go to page 2, but if you press next again it does not work, Thanks ...
2. Interesting - thanks for point that out. One of your two points is most certainly a bug, I'm just not sure which one :-).
2.1 - this was my intention - when you change the length then the first record on display should stay there I think.
2.2. - but that messes up the nicely grouped pages as seen here. What is happening is that the update function isn't realising that the paging has gone slightly out of sync with the buttons due to what has happened above.
So either
- Changing the length should jump the start point to a page starting point for that length
- The update function must take this kind of behaviour into account.
I'm inclined to go with the second one (although the logic for it might be non-trivial :-) ). Does that sound reasonable?
Thanks,
Allan
Okay here we go:
[code]
var iPages = Math.ceil((oSettings.fnRecordsDisplay()-1) / oSettings._iDisplayLength) + 1;
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
[/code]
If you replace the current iPages and iCurrentPage in fnUpdate for "full_numbers" paging, this will fix the bug that you noted. This will be included in the next release.
Regards,
Allan
It works well !!!
Last thing, I know that it's not in the right section but it's pertinant to the item 2, I'm trying to make after the change of numbers of rows to paginate, that the list goes to page 1 and doesn't try to keep the first row before the change in first position, but I only succeed in making it go do first page ... Where I must change to make the sort be reloaded without keeping this first row??
Thanks ...
I'm afraid I'm a little confused as to what you are trying to do. Could you explain it again please (sorry - I think I might be having a brain freeze!).
Allan
Currently after you change the rows number, it calculates the page to be displayed and the first row is the one that was there before
Well, I'm trying to change the behavior of the displaylength,
When the number of rows is changed, I'd like that it goes to the first page, and the rows be draw according to this new rows display ...
I think this is more clear eheheh,
Thanks ...
Does this help?
Allan
Nice work with this excellent source !! ..