Using the component for paged lists
I have some lists that *must* be paged because I would run out of memory on the server otherwise.
Is there any way to either:
A) Use the new virtual table data functionality to load data in pages at a time? (I know you can do the whole list asynchronously... but what about pages)
B) Use the grid control to display an individual page which means I need the the column headers to link to server pages (new ordering) as opposed to doing client-side sorting
Can anybody help me with this? I would really like to use this component for both paged and non-paged lists. Thanks.
Joe Hudson
October 10,
Does anybody have any advice about this? I have to believe that somebody has run into this scenario before... Thanks.
Joe Hudson
October 12,
Joe,
I think the best solution (from user experience point of view) is still using virtual mode in the grid but make your external data model retrieving data in pages behind the scene. In this case sorting should be done on the server side because not all data will be available on the client side. One possible improvement for server-side sorting is to send not complete new dataset but just an array of row indices in desired order.
Some bits of functionality necessary for this implementation are still missing from beta1 (i.e. how to display loading status of the row or complete grid, how to trigger repaint of the newly loaded page of data etc.) - I will try to add them in the next weeks together with 'normal' paged grid example.
Alex (ActiveWidgets)
October 12,
Thank you so much Alex! I can't tell you how much that functionality would help me. When you add the functionality, would you be able to provide a simple example as well?
Also, please remember that in this case, the column headers shouldn't trigger the client-side resort because not all of the data will necessarily be loaded when they trigger the re-sort. Instead, it should make a call to the server to allow the server to re-sort. Is there any way to accomodate this? Thanks.
Joe
Joe Hudson
October 12,
With the new grid you can easily attach your own event handlers and cancel the default ones. The following code should work in beta1:
obj.onHeaderClicked = function(event, i){
alert(i);
return true;
}
Alex (ActiveWidgets)
October 12,
AWESOME!
This will be perfect when you add the lazy loading stuff so I can serve out data in page sets. Thanks very much Alex.
Joe
Joe Hudson
October 14,
By the way, is there any way that I can "tell" the component to show the up/down arrow for a specific header? For example, if I make the column headers links and perform the ordering on the server side, I would like the component to show which column was ordered just like on the client side ordering. Thanks for your help.
Joe
Joe Hudson
October 14,
Anybody know an answer to this?
I would like to make the component show an arror (indicating a sorted column) manually in the case of server-side sorting. Is this possible? Thanks.
Joe
Joe Hudson
October 16,
Joe, I think it's not possible to show asc/desc arrows on demand without perform a local sorting (or I couldn't find it).
I just found a way to enable/disable showing arrows for all columns.
#myGrid .aw-grid-sort {display: none;} //// or display:inline
But Alex's replacing-event also include this.
I would suggest a work-around . (if matches your needs)
Use the AW.Grid.Extended ,and then create a second column-header to display a symbol or just ASC DESC. and/or use
column-header-cell // whole-column ---- background colors.
Hope given new ideas.
Best
Carlos
October 17,
Thank you very much for your answer Carlos. It is very much appreciated.
Alex, is there any way that this feature could be added for version 2? Thanks.
Joe
Joe Hudson
October 17,
I am anxious to get this feature as well.
Rick Harris
October 17,
Actually you can already manipulate sorting indicator in 2.0b1. The indicator is linked to sort direction property -
var obj = new AW.UI.Grid;
obj.setCellText(function(i,j){return j});
obj.setColumnCount(10);
obj.setRowCount(10);
obj.onHeaderClicked = function(event, index){
window.status = "Header clicked: " + index;
var i = this.getSortColumn();
if (this.getSortDirection(i)) {
this.setSortDirection("", i);
}
this.setSortColumn(index);
this.setSortDirection("ascending", index);
this.refresh();
return true;
};
document.write(obj);
Alex (ActiveWidgets)
October 17,
Thanks so much for the answer, Alex.
Joe
Joe Hudson
October 18,
I must be doing something wrong but setting the sort index does not seem to be working... I'm trying doing it before the grid gets rendered.
var obj = new AW.UI.Grid;
obj.setHeaderText(["1","2","3"]);
obj.setRowCount(1);
obj.setColumnCount(3);
//obj.setSortColumn(2);
obj.setSortColumn("ascending", 2);
document.write(obj);
I cut out some stuff for ease of reading...
I'm just trying to default the grid to show a header with the sort indicator for a specific column. Can you please tell me what I am doing wrong? This is with version 2.0 beta 1. Thanks very much!
Joe Hudson
October 25,