1 Reply Latest reply on Jul 30, 2009 3:54 PM by Y E

    Problem with Ajax command and Seam component scope

    Y E Newbie


      I hope that this is the correct place to ask this question, although I realise some of it may be related to Richfaces.

      In my form I have a field that I use for lookup in another system ( via http request) and populate some of the other fields of the form with the results of that search.

      The way I implemented this in to have an a4j:commandButton in my form calling the search action. The search result is then displayed in a rich:dataTable.

      I have a rich:datascroller that allows me to scroll the table if the number of result items exceeds the rows of the table.

      The problem is that if my search action is in scope EVENT , the scrolling doesn't work. If I change the scope to CONVESRATION - I can scroll, but I cannot perform subsequent searches.

      I thought of using nested conversation, but the documentation says: A nested conversation has its own conversation context, and also has read-only access to the context of the outer conversation. (It can read the outer conversation's context variables, but not write to them.).
      That to me means that I cannot populate the fields of the form with the result of that search.

      Below are some excerpts from my code

      My form:

       <s:decorate id="field1" >
       <h:inputText id="f1"  immediate="true"
            value="#{myEntHome.instance.field1}" >
            <a:support event="onblur" reRender="field1"  />                   
       <a:commandButton value="Lookup" image="img/search.GIF" ajaxSingle="true" 
            id="searchImg" action="#{searchAction.search}"   reRender="myModPanel,field2,field3"
      <h:inputText id="f2"  immediate="true"
            value="#{myEntHome.instance.field2}" >
           <a:support event="onblur" reRender="field2"  />                   
      <h:inputText id="f3"  immediate="true"
           value="#{myEntHome.instance.field3}" >
             <a:support event="onblur" reRender="field3"  />                   

      in my searchResult modalPanel I have:

      <rich:datascroller for="pl" ajaxSingle="true" >
      <rich:dataTable id="pl"    var="_pl" value="#{resultList}"  >             
                <f:facet name="header">
                    <h:outputText value="Criteria"/>
                <h:outputText value="#{_pl.criteria}"/><br/> 

      and my search action looks like this:

      public class mySearchAction
            List<MyResultItem> resultList;
           public void search()
              resultList = something;     

      Could anyone suggest an approach for solving this problem.