-
1. Re: DataTable/Scoller
sergeysmirnov Mar 5, 2007 5:47 PM (in response to trouby)Could you clarify your request a little bit.
The current rich:dataTable has the 'rows' attribute that define how many rows you want to see on the page. So, it is "loading only the relevant rows per selected page" and you can navigate between the pages with rich:datascroller component:
http://livedemo.exadel.com/richfaces-demo/richfaces/dataTableScroller.jsf?c=dataTableScroller
Also, in our TODO list we have another kind of table (let's name it rich:spreadsheet for a while) that works with vertical scrollbar that allows navigate though a huge amount of rows having smart swapping feature where only part of actual rows are downloaded to the client with Ajax.
Do you mean something else? -
2. Re: DataTable/Scoller
trouby Mar 5, 2007 5:56 PM (in response to trouby)Correct me if I'm wrong, but with the current DataTable/Scroller component you must load the entire list, then the list gets paged by the scoller,
Assuming I have 6Million customers to display as a datatable, I have to load the entire list, bind it to the DataTable and then the pager works over the loaded list,
With big amount of rows, loading the entire list is a performance killer,
Regarding the new datatable, yeah, Rico framework has something simliar, I assume:
http://openrico.org/rico/livegrid.page -
3. Re: DataTable/Scoller
fernando_jmt Mar 5, 2007 7:17 PM (in response to trouby)"trouby" wrote:
Assuming I have 6Million customers to display as a datatable, I have to load the entire list, bind it to the DataTable and then the pager works over the loaded list,
With big amount of rows, loading the entire list is a performance killer,
I'm totally agree that it would be a really nice feature to have something that solves it. Currently one can deal with Custom DataModel and so on in order to make this possible. But it could be better the framework allow us to do this easly (this is a very common feature paging/sorting in most enterprise applications). Of course if currently there's a functionality like that, I'm wrong. -
4. Re: DataTable/Scoller
sergeysmirnov Mar 5, 2007 8:15 PM (in response to trouby)"trouby" wrote:
Correct me if I'm wrong, but with the current DataTable/Scroller component you must load the entire list, then the list gets paged by the scoller,
Assuming I have 6Million customers to display as a datatable, I have to load the entire list, bind it to the DataTable and then the pager works over the loaded list,
With big amount of rows, loading the entire list is a performance killer,
Regarding the new datatable, yeah, Rico framework has something simliar, I assume:
http://openrico.org/rico/livegrid.page
There are two parts here:
1. Is the data loaded from the database on the server?
2. is the data loaded from the database is loaded to the client as one whole piece?
The first question is about how smart your custom data model is. The rich:dataTable (as well as future rich:spreadsheet) works with dataModel.
The answer to the second question is NO for both table. You can limit the number of the loaded to the client rows with 'rows' attribute for rich:dataTable. rich:dataspreadsheet will have a buffer (the size is customizable) that allows to load a little bit more rows that are on the screen for smooth scrolling.
And yes, the rich:dataspreadsheet is a similar to the openrico livegrid with some additional enhancements such as:
* resizable columns (by dragging the borders on the header)
* variable rows height
* built-in Drag-n-Drop (single and multi-lines) -
5. Re: DataTable/Scoller
amitev Mar 6, 2007 8:53 AM (in response to trouby)"trouby" wrote:
Correct me if I'm wrong, but with the current DataTable/Scroller component you must load the entire list, then the list gets paged by the scoller,
Assuming I have 6Million customers to display as a datatable, I have to load the entire list, bind it to the DataTable and then the pager works over the loaded list,
With big amount of rows, loading the entire list is a performance killer,
That is not true. See this wiki[1]. There it's shown how to load the date on portions and show it into dataTable. I've done this and it is working.
[1] http://wiki.apache.org/myfaces/WorkingWithLargeTables -
6. Re: DataTable/Scoller
ebu Mar 30, 2007 5:12 PM (in response to trouby)Hi,
I've tried to implement suggested solution, but resulted behaviour seems a bit unexpected. Especially, i found that method getRowData is being called for each (well, almost for each) row in the _whole_ table regardless page size. Here is stack trace:
test.seam.test1.PagedListDataModel<T>.getRowData() line: 28
org.ajax4jsf.ajax.repeat.SequenceDataModel.getRowData() line: 147
org.richfaces.component.html.HtmlDataTable(org.ajax4jsf.ajax.repeat.UIDataAdaptor).setupVariable(javax.faces.context.FacesContext, javax.faces.model.DataModel, boolean) line: 432
org.richfaces.component.html.HtmlDataTable(org.ajax4jsf.ajax.repeat.UIDataAdaptor).setRowIndex(int) line: 258
org.richfaces.component.html.HtmlDatascroller(org.richfaces.component.UIDatascroller).BinarySearch(javax.faces.component.UIData) line: 402
org.richfaces.component.html.HtmlDatascroller(org.richfaces.component.UIDatascroller).getRowCount() line: 380
org.richfaces.component.html.HtmlDatascroller(org.richfaces.component.UIDatascroller).getPageCount() line: 359
org.richfaces.renderkit.html.DatascrollerTemplate(org.richfaces.renderkit.html.DataScrollerRenderer).encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent) line: 69
org.richfaces.component.html.HtmlDatascroller(javax.faces.component.UIComponentBase).encodeBegin(javax.faces.context.FacesContext) line: 512
i.e. Data.setRowIndex(kk-1); not just sets row index but results in call to getRowData in setupVariable thus spoiling all benefits of pagination.
Another question is more of theoretical interest: could you please explain magic which happens in UIDatascroller.BinarySearch? Why to get getRowCount one should do BinarySearch? And why not just binarySearch? :)
wbr, eugen. -
7. Re: DataTable/Scoller
ebu Apr 2, 2007 11:21 AM (in response to trouby)Doesn't anybody have an idea?
wbr, eugen. -
8. Re: DataTable/Scoller
fernando_jmt Apr 2, 2007 11:44 AM (in response to trouby)I implemented some similar as follows:
* Make your own List implementation. E.g. PageList implements List.
* Populate the PageList with data recovered from database (sorted, limited).
* Build a ListDataModel using the PageList.
* Let's rich:dataTable and rich:dataScroller to play with them.
In order to avoid the succesive calls you need to ensure the PageList populated only one time per request:List page; public DataModel getPagedData() { if(page == null) { Query..... page = new PageList(pageElements, firstResult, maxResult, datasetSize) } return new ListDataModel(page) }
HTH. -
9. Re: DataTable/Scoller
tomarenz Apr 3, 2007 5:44 AM (in response to trouby)Hi, while missing any experience with RichFaces so far, I implemented paged data models for both Trinidad and Tomahawk table components.
In both cases the trick was located in the way the custom data model implements setRowIndex: this is usually called with and index value located within current page, so that the custom implementation just needs to keep a cached page of rows. As soon as the index goes out of current cache because of paging, discard the cache and populate a new one.
GetRowData calls come afterwards, they always refer to a previously set index. Thus these calls pick up data from the row cache as prepared by setRowIndex.
I guess (I hope actually) that this remains valid for RichFaces tables as well. -
10. Re: DataTable/Scoller
ebu Apr 4, 2007 6:51 PM (in response to trouby)I'm afraid i doesn't. Finally i've changed my local UIDatascroller.getRowCount() back to return getUIData().getRowCount(); and after that it stoped pulling about all the data.
It would be still very interesting to hear from the code authors about the purpose of using "dichotomic discovery" in the getRowCount.
wbr, eugen.