3 Replies Latest reply on Mar 18, 2010 10:34 AM by Bruce Randall

    ExtendedDataTable problems

    Bruce Randall Newbie

      I 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"/>

      .......           action buttons and stuff .................



              <rich:panel id="selectionPanel">
                  <f:facet name="header">
                      <h:outputText value=" Selections"/>
                  <rich:dataTable id="brkMkSlcts" columnClasses="dataTableColumn"



          <rich:extendedDataTable id="bList"
                                  rowClasses="dataTableInnerEven, dataTableInnerOdd"


              <rich:column id="brkCol-1" label="ID" sortable="true" sortBy="#{brk.id}">
                  <f:facet name="header">
                      <h:outputLabel value="ID"/>
                  <h:outputText value="#{brk.id}"/>



              <a4j:support reRender="brkMkSlcts" id="bListSlctSupport"
                      event="onselectionchange" />


      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?

        • 1. Re: ExtendedDataTable problems
          Rob Acraman Newbie

          > 3. I don't understand how the extended data model is loaded with the capital list.


          The CapitalsBean constructor uses a http://commons.apache.org/digester/ to read an XML file.

          Actually, the digester is based on two files - capitals.xml for the data, and capitals-rules.xml which describes how to map the data to the Capital object and what to do with it - in this case, call addCapital.


          These two XML files don't have any path, so they're looked for in the class' (not the source) directory - WEB-INF\classes\org\richfaces\demo\capitals


          Scroll bars are only displayed when required, so should appear when your table gets populated.

          • 2. Re: ExtendedDataTable problems
            Ilya Shaikovsky Master

            Rob, thanks for your participation. You answers looks fully correct. One small addition - EDT does not supports horizontal scrollbar in 3.3.3. (But it will in 4.x)


            And the last problem about sizes seems similar to http://community.jboss.org/message/532651#532651 with example attached so will check and update in the thread mentioned.

            • 3. Re: ExtendedDataTable problems
              Bruce Randall Newbie

              Thanks Rob. I was not clear in my question, I understand how the list is loaded from the xml files. What I don't understand is how the list is bound to the extended model. We are converting from Simplica to RichFaces so I was expecting something like taking my list of objects obtained from Oracle and set them in the Model m = new Model(list<object>) and rebind the model to the table table.setModel(m).


              In my case when I bind to the object list (value="#{nwtBean.objList}")the table renders the object attributes. When I bind to the the model (value="#{nwtBean.listModel}") I get no data.


              I just don't see how this is done from the code I can find or any tutorials.