-
1. Re: partially loading of data
eugenbesel Mar 1, 2010 1:26 AM (in response to eugenbesel)perhaps is DataScroller the correct component for it??? -
2. Re: partially loading of data
ilya_shaikovsky Mar 1, 2010 3:50 AM (in response to eugenbesel)you could improve the performance by implementing "true paggination" like there http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=dataModel and there http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=modifiableDataModel in order to deal only with curernt page data. -
3. Re: partially loading of data
eugenbesel Mar 1, 2010 5:11 AM (in response to ilya_shaikovsky)sorry, but I didnt understand you. which method is responsible for pagination???
I can not see any pagi* in Tag-information
-
4. Re: partially loading of data
ilya_shaikovsky Mar 1, 2010 5:26 AM (in response to eugenbesel)data model responsible for that. checkout full dem sources from svn to look through. -
5. Re: partially loading of data
eugenbesel Mar 2, 2010 2:29 PM (in response to ilya_shaikovsky)hello Ilja,
I looked into the examples AuctionDataModel.
http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=dataModel&cid=6128375
I have some questions about it.
In this example we know which objects exist.
I work with attribute columns and use List<ArrayList<String>> as DataModel. Just a list of Strings, which shoud be shown in dataTable.
please correct me if I stay wrong:
public class AuctionDataModel extends SerializableDataModel {
private AuctionDataProvider dataProvider;
private Integer currentPk; // DO WE NEED currentPk for this case???? what is Pk for the List<ArrayList<String>> ???
private Map<Integer,ArrayList<Strng>> wrappedData = new HashMap<Integer,ArrayList<String>>();
private List<Integer> wrappedKeys = null;public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) throws IOException {
int firstRow = ((SequenceRange)range).getFirstRow();
int numberOfRows = ((SequenceRange)range).getRows();
wrappedKeys = new ArrayList<Integer>();
for (ArrayList<String> item:getDataProvider().getItemsByrange(new Integer(firstRow), numberOfRows)) {
wrappedKeys.add(item.getPk()); // I dont have Pk on this place
wrappedData.put(item.getPk(), item);
visitor.process(context, item.getPk(), argument);
}
}I dont know how should I implement this model for extendedDataTable with <rich:columns
can you please help me.
thank you
-
6. Re: partially loading of data
eugenbesel Mar 3, 2010 2:54 AM (in response to eugenbesel)I tried to implement PK=item.get(0).
I have modified the example auctionDataModel
Now I have some troubles:
the line:
dataProvider = lookupInContext(auctionDataProviderExpressionString, AuctionDataProvider.class);
provides null.
If I initialize dataProvide directly like
private AuctionDataProvider dataProvider = new AuctionDataProvider();
then I have an object and the table is displayd, BUT without data.
The cause is:
the method getRowData() provides null
the cause is: currentPK is not setted.
on this place the question. who should set the value for currentPK???????
I setted brakepoint into setter and it go in, but the value for currentPK is always null.
any idea?
thank you
-
7. Re: partially loading of data
gamba Mar 3, 2010 4:05 AM (in response to eugenbesel)Hi Eugene,
I'm facing the same situation. I found another example in the source (via SVN) in
richfaces-ui-3.3.2.SR1\samples\richfaces-demo\src\main\java\org\richfaces\demo\extendedDataTable
Maybe this could help you. The interesting snippet is this one:
... public ExtendedTableDataModel<Capital> getCapitalsDataModel() { if (dataModel == null) { dataModel = new ExtendedTableDataModel<Capital>(new DataProvider<Capital>(){ private static final long serialVersionUID = 5054087821033164847L; public Capital getItemByKey(Object key) { for(Capital c : capitals){ if (key.equals(getKey(c))){ return c; } } return null; } public List<Capital> getItemsByRange(int firstRow, int endRow) { return capitals.subList(firstRow, endRow); } public Object getKey(Capital item) { return item.getName(); } public int getRowCount() { return capitals.size(); } }); } return dataModel; }
You can change the "Capital"-object with your own.
Greets
Holger
-
8. Re: partially loading of data
eugenbesel Mar 3, 2010 6:19 AM (in response to gamba)Hello Holger,
thank you for your advice. I also tried to implement your example, but the table is still empty. I think I must initialize the data of the table. In your example I can not see any init method.
where come the dataValues from??
-
9. Re: partially loading of data
eugenbesel Mar 3, 2010 2:21 PM (in response to eugenbesel)my Model looks like:
public ExtendedTableDataModel<ArrayList<String>> getCapitalsDataModel() {
if (extendedDataModel == null) {
extendedDataModel = new ExtendedTableDataModel<ArrayList<String>>(new DataProvider<ArrayList<String>>(){
private static final long serialVersionUID = 5054087821033164847L;
public ArrayList<String> getItemByKey(Object key) {
for(ArrayList<String> c : dataList){
if (key.equals(getKey(c))){
return c;
}
}
return null;
}
public List<ArrayList<String>> getItemsByRange(int firstRow, int endRow) {
return dataList.subList(firstRow, endRow);
}
public Object getKey(ArrayList<String> item) {
return item.get(0);
}
public int getRowCount() {
return dataList.size();
}
});
}
return extendedDataModel;
}is it correct??
-
10. Re: partially loading of data
eugenbesel Mar 7, 2010 1:57 AM (in response to eugenbesel)has anybody an idea how should I implement DataModel for the dynamic DataTable with attribute columns??