When I started to use ADF Faces with ADF BC problem dissapered, however there are still projects where we use just ADF Faces part (now MyFaces Trinidad) and there are no out-of-the-box solution to fetch the data on demand.
Recently I found one example, which is describing the solution to use with classic JSF DatModel, on MyFaces wiki site - http://wiki.apache.org/myfaces/WorkingWithLargeTables.
I have adopted this example to be more universal and to work with ADF Faces table sorting and paging.
Example consists of three classes -
CollectionModelimplementation,
DataPage, and data fetch listener interface which should be implemented in the model binding/service layer.
Whenever new page is needed, listener will be called.
There is also one additional interface
Identifiablewhich is used to better leverage ADF Table rowKey conception. This interface could be implemented by the Entity class (single table row) in order to provide rowKey to the ADF Table.
You can download complete example JDeveloper workspace from here:
DataOnDemandExample.zip
Update: Broken link has been fixed.
To use the example you will need to setup MyFaces Trinidad 1.0.X libraries.
22 comments:
This comment has been removed because it linked to malicious content. Learn more.
This comment has been removed because it linked to malicious content. Learn more.
This comment has been removed because it linked to malicious content. Learn more.
could you please share your workspace. Or atleast post the DataPage class.
See Here or Here
See here or here
SECURITY CENTER: See Please Here
See Please Here
Hello Veniamin.
Is this solution valid for ADF tables (not Trinidad) even if you are using org.apache.myfaces.trinidad.model.CollectionModel?
Have you tried it in production system whid large tables? What about it?
Thak you very much.
to el holgazán: Yes, you can use this solution with ADF Tables as well, however you should change org.apache.myfaces.trinidad.model.CollectionModel class to appropriate class from ADF package.
This solution is working well in production with large enough tables.
Hi Veniamin,
the download link of the example wont work.
Please fix it.
Can you mail me the sample in advance?
--
Regards,
Mathias
I have updated the broken link. Now it is working. Sorry for inconvenience.
Hi The pagination solution looks cool except for the dropdown range.
the range range drop is done based on the total count and it would be nice if we can show the items based on uset Navigation. I saw in latest trinidad version the display more as a link rather than displaying the whole range list. Is this possible in 1.0.10 version
Ram, what do you mean exactly? I did not get. Can you provide example?
Thanks for ur response and i apologize for not being clear.
By default Trinidad shows a Range dropdown during pagination. Let us say there are 100 records and page size is 25. By default it shows all the ranges.I don't want to show
1-25,25-50,50-100 in the range dropdown.I just want to show say 1-25 initially. When the user moves to next page the range will have one more value 25-50. So the Range dropdown keeps increasing as per user navgation. plz refer below link for a exampe
http://www.irian.at/trinidad-demo/faces/components/table_dynamic.jspx
I got my problem resolved. If the Page size by default exceeds 30 ranges (for eg if i have 1000 + records and my page size is 25 trinidad by default shows ranges from 1-25 ... 725-750. After that it displays more link in dropdown. If i click it fetches the next 30 ranges.It limits the no of ranges shown in dropdown.Also it removes the showAll option shown in the range dropdown for larger data sets.This makes sense
Hello Veniamin
This is regarding the usage of memory (PageFlow Scope) in Pagination.
Iam checking the memory usage in session when I use the pagination. On each click of Next iam seeing an increase of 21 bytes of memory. This is never cleaned up until the session is invalidated(user logs off).
Can this thing be cleaned up?
On First Click of Next:(memory uage -537 bytes)
org.apache.myfaces.trinidadinternal.Change (java.util.HashMap) 1 items: '{/jsf/zipPaginate.jspx={_id4:_id4=[org.apache.myfaces.trinidad.change. AttributeComponentChange@5dea5dea, org.apache.myfaces.trinidad.change. AttributeComponentChange@1e2e1e2e]}}' 537
After clicking Next twice iam seeing memory usage got increased by 42 bytes (now 579 bytes)
org.apache.myfaces.trinidadinternal.Change (java.util.HashMap) 1 items: '{/jsf/zipPaginate.jspx={_id4:_id4=[org.apache.myfaces.trinidad.change. AttributeComponentChange@5dea5dea, org.apache.myfaces.trinidad.change. AttributeComponentChange@1e2e1e2e, org.apache.myfaces.trinidad.change. AttributeComponentChange@2b5c2b5c, org.apache.myfaces.trinidad.change. AttributeComponentChange@5f3a5f3a]}}' 579
Ram, it seams, that it is a memory leak in the internals of trinidad.
You should try to address your question in the trinidad mailing list at http://myfaces.apache.org/trinidad/mail-lists.html
Hello,
I tried this application but getting this error at compile time:
Error(33,19): class com.blogspot.vgoldin.view.beans.EmployeeListHandler.EmployeeRefreshCollectionListener should be declared abstract; it does not define method refreshCollection(java.util.List, int, int) of interface com.blogspot.vgoldin.view.RefreshCollectionListener
Note : I am using this in Jdev 11g and using import oracle.adf.view.rich.model.SortCriterion; instead trinidad s SortCriterion as it extends the trinidad one.
Dear Saroja, I haven't tried this example with JDev 11g. Could you please try to remove SortCriterion generic in the EmployeeListHandler or add it in the RefreshCollectionListener interface?
Post a Comment