1 Reply Latest reply on Aug 19, 2008 11:47 AM by mail.micke

    Problems with values refreshing.

    doubledenim

      I've only just started messing about with seam and I'm still trying to get my head around how it operates. I've basically been making changes to a crud app i generated with eclipse.


      I've got the following bit of code which is a select list with a bunch of articles in it and a data table which displays all results of related articles to a page (yes i'm trying to build an admin front end for my cms).


      The problem I'm having is that the data table doesn't update after I've added values to the page via the select list. Is there anything i can/should be doing to make pageRelatedArticleList.getPageRelatedArticles(pageHome.instance.pageId)
      get executed so the list can be updated?



          <rich:tab label="related articles">
      
               
           <h:form id="addArticle" styleClass="edit">
          
                 <rich:panel>
                  <f:facet name="header">Add Faq Item</f:facet>
      
                  <s:decorate id="articleDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">article</ui:define>
                               <h:selectOneMenu value="#{pageRelatedArticleHome.instance.article}">
                
                                          <f:selectItems value="#{pageHome.relatedArticles}" />
                                         <s:convertEntity />
                                    </h:selectOneMenu>
                  </s:decorate>
      
                <div style="clear:both">
                      <span class="required">*</span> 
                      required fields
                  </div>
              </rich:panel>
      
              <div class="actionButtons">
                  <h:commandButton id="save" 
                        value="Save" 
                        view="/PageEdit.xhtml"
                        action="#{pageRelatedArticleHome.persist(pageHome.instance)}"/>  
                </div>
      
          </h:form>
                    
      
                    
      
                  <rich:dataTable value="#{pageRelatedArticleList.getPageRelatedArticles(pageHome.instance.pageId)}" 
                                 var="pageRelatedArticle" 
                            rendered="#{not empty pageHome.pageRelatedArticles}" 
                          rowClasses="rvgRowOne,rvgRowTwo"
                                  id="pageRelatedArticlesTable">
                      <h:column>
                          <f:facet name="header">ID</f:facet>
                          <h:outputText value="#{pageRelatedArticle.pageRelatedArticleId}"/>
                      </h:column>
                      <h:column>
                          <f:facet name="header">articleId</f:facet>
                          <h:outputText value="#{pageRelatedArticle.article.articleId}"/>
                      </h:column>
                      <h:column>
                          <f:facet name="header">title</f:facet>
                          <h:outputText value="#{pageRelatedArticle.article.title}"/>
                      </h:column>
                      <h:column>
                          <f:facet name="header">action</f:facet>
      
                  <s:link view="/#{empty from ? 'PageRelatedArticle' : from}.xhtml" 
                         value="Select" 
                            id="pageRelatedArticle">
                      <f:param name="pageRelatedArticlePageRelatedArticleId" 
                              value="#{pageRelatedArticle.pageRelatedArticleId}"/>
                  </s:link>    </h:column>
                  </rich:dataTable>
              
      
                
      
          </rich:tab>


        • 1. Re: Problems with values refreshing.
          mail.micke

          Try debugging the getter and if it gets called and what the parameter is.


          Is pageRelatedArticleList.getPageRelatedArticles calling the database? If it is you might want to consider a little re-design because that getter might get called several times during a request.


          Also the rendered checks pageHome.pageRelatedArticles, is pageRelatedArticlesList outjected from page home for useage by the value attribute?
          What if you don't use the outjected object does that work (get it via pageHome instead)?


          It is a bit difficult to try and figure out how the different classes interact, if you can't figure out why it doesn't work post the java code and it will be easier to help out.


          cheers,
          micke