PAGING with Version 2.0
has any one implemented or wrote a snippet of code to wrk with the grid to do paging like v 1.0, if so can you plz post some information on how to?
thanks
K.P
February 20,
Anyone ?
K.P
February 21,
I don't think anyone is working on it because the virtual paging mode in 2.0 works very well. How much data are you talking about returning to the grid?
Jim Hunter (www.FriendsOfAW.com)
February 21,
Jim,
Its not abt how much data, it abt appealing appreance as well as ability for users to view returned dataset page by page rather than scrolling to 79000 rec number, if you c wat i mean... i hope alex or someone can help... also the sorting is killing the performance not sure this is worth spending time but really hope someone gives a suitable solution or workaround to these 2 issues....since this is really a gr8 grid and worth to work with it...
thnks
K.P
February 21,
A paging feature would be very nice. In my case, we are implementing a unique paging control within a fixed grid size with an option to specify how many rows are displayed at one time. Can you explain the virtual paging mode? The only virtual mode I am aware of with the grid is a virtual drawing mode that only renders the visible rows, but that is a bit frustrating and disconcerting due to its intermittent blanking behavior, aside from the fact that a user has to physically scroll down through the entire data set to get to something near the end.
Kwooda
February 21,
If you want real "paging", then the grid isn't going to do it for you. The grid doesn't have any idea of what you are doing at the server. You are going to have to write the code yourself, it isn't hard. I did it for ver 1 and it worked fine. I created a navigator that had First/Previous Page/Previous/Next/Next Page/Last buttons and when they hit the page buttons it sent a command back to the server to give me the next set of data. On the client side I swapped out the data in the grid and did a refresh. It wasn't rocket science, but you do have to take into consideration things like the user moving the selected row, via key strokes, past the last row on the page or up to a previous page. At that point you have to swap the data again. If you have a grid with about 20 rows of data this swapping is very fast and the user hardly notices that you are round tripping the server.
So if you don't want to use the Virtual Paging (rendering) built into the latest grid you are going to have to write some code.
Jim Hunter (www.FriendsOfAW.com)
February 22,
Jim, I think you're missing the point. K.P. wanted paging as a navigation feature - no one said anything about server-side paging.
While I realize that it might *seem* ridiculous to some, I can not implement version 2 unless it has a paging feature. I am dissapointed with the loss of paging in the new version (even if I have to load the entire dataset on the client) because our users love their creature-comforts (read: they hate scrolling) and because all of our documentation is already published with screenshots and descriptions including the paging functions. At this stage of the game, I'm fixing performance bugs etc and don't want to disrupt the interface.
If I could implement AW version 2 without sacrificing the functionality (read: usability features) we had with AW version 1, then we're in business.
Pete
August 2,
I agree with pete on this paging is a nice client side feature and is more suited to some situations.
Offering a patch to the grid so it pages data is a good idea for alex to do. Like we had for version 1.
tbh virtual scrolling I can't see anyone using it because of the way it renders it just looks very poor people like seeing a solid display of data
August 3,
In AW 2.0 the grid has
row offset property which allows very simple client-side paging (similar to 1.0 paging patch) -
var obj = new AW.UI.Grid;
obj.setCellData(function(col, row){return col + "." + row});
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(10);
document.write(obj);
document.write("<br>");
var button = new AW.UI.Button;
button.setControlText("Next");
document.write(button);
button.onControlClicked = function(){
var x = obj.getRowOffset();
obj.setRowOffset(x+10);
obj.refresh();
}
Set row count to the number of rows on the page and row offset to the page start.
Alex (ActiveWidgets)
August 3,
On that blanking behavior?
Patrick
August 3,
Brilliant Alex, thanks!
AcidRaZor
August 4,
Alex, when using obj.setRowCount(10); with CSV loading (for above example to page etc) it breaks with undefined. Any ideas how we could ajust it for using data sources like CSV?
AcidRaZor
August 4,
Probably you should do it AFTER the data is loaded, i.e. in table.response() callback.
Alex (ActiveWidgets)
August 8,
For those interested in overriding the table.response method, here is the code :
table.response = function(text){
this._rows=text.split(/\r*\n/);
if(!this._rows[this._rows.length-1]){
this._rows.pop()
}
this._data=[];
if(this.$owner){
this.$owner.clearScrollModel();
this.$owner.clearSelectedModel();
this.$owner.clearSortModel();
this.$owner.clearRowModel();
this.$owner.setRowCount(5);
this.$owner.refresh()
}
};
AcidRaZor
August 9,
There's an error that I picked up. When doing x+10 on the RowOffset AFTER sorting by a column, I get a this._rows[...] is null or not an object.
Any idea what might be causing this?
AcidRaZor
August 9,
Firefox has it as this._rows[r] has no properties
AcidRaZor
August 9,
Anyone has an idea why this is happening?
AcidRaZor
August 11,
AcidRaZor,
I think that if the setRowCount() "patched request" is lower than the total file-rows , it's not possible for the sort operation to return a valid Indices.
I have done it with two grids , one (hidden) to load CSV file, and another (for paging & visible) that takes it's CellTexts.
Anyway this solution adds "some" complexity, and around 350 total code lines ( pagenumber-input plus goto-page button included).
HTH
Carlos
August 11,
Hi Carlos, thanks for the feedback.
I have over 8000 rows in one grid. I only show 10 at a time (as per the example)
I created a "back" button as well which would do x-10 and a "reset" button that would go back to 0.
Whenever I sort (by any column) and then try to move forward (this is on the 1st or 2nd page) it breaks, however, I can still move backward or reset the row.
Maybe I'm just misreading your explanation as to why this is happening. As far as I'm concerned we're working with the rowOffset, not the specific indices (or are we?). The offset would be 0/10/20 etc as it grows. But I see no reason in it breaking if I was sorting 10-19 and then want to jump to 20. However, going in reverse, it works.
AcidRaZor
August 11,
I just realized that current sort function does not support this scenario, i.e. it does not know that you have 8000 rows (and not 20 or 40 ...). I don't know yet what is the best way to handle this.
Alex (ActiveWidgets)
August 11,
Thanks for the answer Alex, I'm still not convinced that it must be the sort function, or else the back and reset button I put in would have broken too? If I have time I'll go look at it. Otherwise paging is working perfectly (just a few tweaks here and there to determine max rowoffset etc or else it breaks for obvious reasons)
AcidRaZor
August 12,
Any feedback on this?
AcidRaZor
August 22,
Have you looked at using a QuickFilter instead of paging?
A textbox at the top of the grid that specifies what rows in the grid are shown? (iTunes uses this feature)
I have used it at several clients with very good results.
If you are though set on Paging then my suggestion would be to hide the rows not on the current page. Then when you "Page" simply show the rows on the next page and hide the current rows.
Karl Thoroddsen
August 22,
I am also having a problem with paging and sorting. I am using the above code from Alex to do the paging for my grid. it works well on its own but if i sort a row and try to go to the next page it freaks out. There are no error messages but the next page has no data on it, it is completely blank.
Has anyone come accross this problem? Any ideas on how to fix it?
Thanks
Adam
August 30,
Nevermind, I found the answer under "Blank page during paging" the function that overrides the onHeaderClicked works great!!
THANKS :-)
Adam
August 30,
Paulo Cesar Silva Reis (PC from Brazil).
September 4,
To: Paulo Cesar Silva Reis
When I used the paging function in your demo, but it perhaps has a conflict with the "column sort".
The "column sort" only works in the single page, not in all the pages when I used the paging function. Any workaround?
Thanks.
January 9,
To: Paulo Cesar Silva Reis
There's sth wrong on your demo page and I can't see the grid. Could you please fix it?
Thanks.
Nicole
February 12,
Pc (from Brazil)
February 12,
This topic is archived.
See also:
Back to support forum