4 Replies Latest reply on Sep 30, 2009 6:10 PM by snowhite

    rich:modalPanel getting closed on row selection

    snowhite

      Hi,

      I have a rich:modalPanel having a scrollableDataTable in it. I want to populate another component (which is in the same modalPanel) based on row selection in scrollableDataTable. But my modalPanel is getting closed when user is making the selection. Can anyone have an idea of whats going wrong

      Below is the modalPanel code:

      <rich:modalPanel id="panel" autosized="false" keepVisualState="true" width="750" height="500" style="background-color:White;">
       <f:facet name="header">
       <h:outputText value="#{selectedSO.soNumber}" styleClass="hClass" />
       </f:facet>
       <f:facet name="controls">
       <span style="cursor: pointer" onclick="javascript:Richfaces.hideModalPanel('panel')">X</span>
       </f:facet>
       <a4j:form>
       <h:panelGrid columns="4" id="detail" >
       <h:outputLabel value="SO #" for="soNumber" styleClass="Label"/>
       <h:outputText value="#{selectedSO.soNumber}" id="soNumber" />
      
       <h:outputLabel value="No. of Items" for="items" styleClass="Label" />
       <h:outputText value="#{selectedSO.numberOfItems}" id="items" />
       </h:panelGrid>
       <rich:spacer height="2" />
       <rich:scrollableDataTable value="#{lstSoDetail}" var="item1" height="150px" selection="#{module1Manager.selection}">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Item #" />
       </f:facet>
       <h:outputText value="#{item1.itemNumber}" />
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="PN" />
       </f:facet>
       <h:outputText value="#{item1.pn}" />
       </rich:column>
       ...............
       <a4j:support reRender="panelTest" actionListener="#{module1Manager.takeSelection}" event="onselectionchange" oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
       </rich:scrollableDataTable>
       <rich:panel header="#{module1Manager.testStr}" id="panelTest"></rich:panel>
       </a4j:form>
      </rich:modalPanel>
      


      takeSelection() code contains following code in it:
      public void takeSelection(){
       Iterator<Object> iterator = getSelection().getKeys();
       Object key = null;
       while(iterator.hasNext()){
       key = iterator.next();
       }
       testStr = lstSoDetail.get(Integer.parseInt(key.toString())).getSodAutoKey();
       }
      


      Thanks