ExtendedDataTable problems
cobar Mar 17, 2010 8:16 PMI have implemented the extendedDataTable using the demo as a guide. Inside a rich:tab
<h:panelGrid id="bGrp" styleClass="containers" style="#{nwtBean.bGroupStyle}"
columns="2" columnClasses="top , top">
<h:panelGroup id="selectionGrp" layout="block" style="width:200px;">
<rich:panel id="ccActions" styleClass="center">
<f:facet name="header">
<h:outputText value="Actions"/>
</f:facet>
....... action buttons and stuff .................
<rich:panel id="selectionPanel">
<f:facet name="header">
<h:outputText value=" Selections"/>
</f:facet>
<rich:dataTable id="brkMkSlcts" columnClasses="dataTableColumn"
value="#{nwtBean.selectedStuff}"
var="slct">
</rich:dataTable>
</rich:panel>
</h:panelGroup>
<rich:extendedDataTable id="bList"
value="#{nwtBean.extendedDataModel}"
binding="#{nwtBean.listTable}"
columnClasses="dataTableColumnSmall"
headerClass="dataTableHeader"
rowClasses="dataTableInnerEven, dataTableInnerOdd"
selectionMode="multi"
sortMode="single"
styleClass="dataTable"
style="overflow:auto"
width="880px"
var="brk">
<rich:column id="brkCol-1" label="ID" sortable="true" sortBy="#{brk.id}">
<f:facet name="header">
<h:outputLabel value="ID"/>
</f:facet>
<h:outputText value="#{brk.id}"/>
</rich:column>
.......
<a4j:support reRender="brkMkSlcts" id="bListSlctSupport"
action="#{nwtBean.takeSelection}"
event="onselectionchange" />
</rich:extendedDataTable>
Problems I am having:
1. I can not get the table to contain horizontal or verticle scroll bars.
2. The columns do not hold the width probably because the overflow is not working?
3. I don't understand how the extended data model is loaded with the capital list.
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;
}
I see no reference to the capitals list being loaded from org.richfaces.demo.capitals.CapitalsBean (http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/capitals/CapitalsBean.java) in the
org.richfaces.demo.extendedDataTable.ExtendedTableBean (http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/extendedDataTable/ExtendedTableBean.java)
So my version of the model renders no data. If I bind to the list directly then it renders column values?