-
1. Re: How do you make rich:datascroller do true pagination?
mcmurdosound Jun 2, 2012 3:35 AM (in response to sabarinathsss)you have to look at the examples.
-
2. Re: How do you make rich:datascroller do true pagination?
sabarinathsss Jul 17, 2012 9:16 AM (in response to mcmurdosound)Hi
In this "http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=dataTable&sample=arrangeableModel&skin=blueSky" example they use only one entity class and they select the values from one table and return as Entity class.
@Override
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
CriteriaQuery<T> criteriaQuery = createSelectCriteriaQuery();
TypedQuery<T> query = entityManager.createQuery(criteriaQuery);
SequenceRange sequenceRange = (SequenceRange) range;
if (sequenceRange.getFirstRow() >= 0 && sequenceRange.getRows() > 0) {
query.setFirstResult(sequenceRange.getFirstRow());
query.setMaxResults(sequenceRange.getRows());
}
List<T> data = query.getResultList();
for (T t : data) {
visitor.process(context, getId(t), argument);
}
}
So in walk method they use the primary key(rowkey) value from the result set and call the getRowData().
But i need to select values from multiple tables(join multiple tables) and return it as ArrayList<HashMap>.
Here how can i do true pagination?
Regards
Sabarinath
-
3. Re: How do you make rich:datascroller do true pagination?
sivaprasad9394 Jul 19, 2012 9:25 AM (in response to sabarinathsss)Hi,
You just create getter setter in one single class for remaining table select values.and assign it to the getter setter methods to form a List<ClassName> like arratyList.
OR
Create object inside the single classExample,
ClassA inside create classB,ClassC,ClassD objects and assign the select ouery values for that,First time it comes like Obj[0],Obj[1]... like u can create and type cast the object to defined class type and add into the base ArryList.
Like,example
PaymentData dataObj = new PaymentData();
dataObj.set...();
dataObj.set...();
MoneyData moneyObj = new MoneyData();
moneyObj.set...();
dataObj.add(moneyObj);
Like u can add alla the array list class to dataObj object and return it to the screen.
It will work as you expected...
Thanks,
Siva
-
4. Re: How do you make rich:datascroller do true pagination?
sabarinathsss Jul 19, 2012 9:36 AM (in response to sivaprasad9394)Hi sivaprasad krishnaswamy,
Thanks for your reply .
Can you please provide the detailed example .
And here how can i override the walk method for true pagination?
Thanks,
Sabarinath
-
5. Re: How do you make rich:datascroller do true pagination?
sivaprasad9394 Jul 19, 2012 9:47 AM (in response to sabarinathsss)Please go through the document ,
https://community.jboss.org/thread/6805
https://community.jboss.org/thread/165635
Thanks,
Siva
-
6. Re: How do you make rich:datascroller do true pagination?
sabarinathsss Jul 31, 2012 3:13 AM (in response to sivaprasad9394)Hi
I m tried the true pagination by using the above example provided in https://community.jboss.org/thread/165635.
Now "
getRowCount()"
method is called more number of times.In which order or how the methods [
setRowKey,
getRowKey,
walk,
isRowAvailable,
getRowCount,
getRowData,
getRowIndex,
setRowIndex
]are executed?
Thanks ,
Sabarinath.