5 Replies Latest reply on Jul 11, 2009 9:22 AM by totoranky

    ExtendedDataModel and simple bean

    totoranky

      Hi

      I tried to use ExtendedDatamodel to keep my model during postback operations, so I can work with my collections for a datatable etc...

      How can I do to use this extendedDataModel with a classical bean.

      <rich:dataTable id="tableEstablishment" value="#{model}" var="establishments" rows="10">
      
      <rich:column>
      <f:facet name="header"><h:outputText value="Action" /></f:facet>
      <a4j:commandButton value="d" action="#{model.test}" reRender="tableEstablishment" />
      </rich:column>
      </rich:dataTable>


      When I click on my button I can't reach my "test" method in my model class.

      I Think I must use another bean. My question , is it possible to handle the extendedDataModel and actions methods in the same class ?
      If not, where I must implement my actions methods ?

      thanks


        • 1. Re: ExtendedDataModel and simple bean
          nbelaevski

          Hi,

          This should work, please post more details.

          • 2. Re: ExtendedDataModel and simple bean
            totoranky

            My faces-config

            <managed-bean>
             <managed-bean-name>model</managed-bean-name>
             <managed-bean-class>com.myCompany.webSchool.bean.administration.TestModel</managed-bean-class>
             <managed-bean-scope>request</managed-bean-scope>
             <managed-property>
             <property-name>establishmentDao</property-name>
             <value>#{establishmentDao}</value>
             </managed-property>
             </managed-bean>


            • 3. Re: ExtendedDataModel and simple bean
              totoranky

              Sorry I can't edit my old post

              <managed-bean>
               <managed-bean-name>model</managed-bean-name>
               <managed-bean-class>com.TestModel</managed-bean-class>
               <managed-bean-scope>request</managed-bean-scope>
              </managed-bean>



              my bean java code

              public class TestModel extends SerializableDataModel {
              
               private EstablishmentDao establishmentDao;
               private Integer currentPk;
               private Map<Integer,Establishment> wrappedData = new HashMap<Integer,Establishment>();
               private List<Integer> wrappedKeys = null;
               private Integer rowCount;
              
              
               public TestModel(){}
              ..........
              
              public void test(){
              }


              I don't reach the test method

              • 4. Re: ExtendedDataModel and simple bean
                nbelaevski

                Add PhaseTracker and check that 5th phase wasn't skipped.

                • 5. Re: ExtendedDataModel and simple bean
                  totoranky

                  If I use ajaxSingle set to true I can reach my action method
                  but in this context my ExtendedData model is not initialized
                  and I can't cal dataTable.getRowData() to delete an item for example