1 Reply Latest reply on Jun 15, 2009 4:50 AM by wang wei

    why extendedDataTable-selection in modalPanel cannot catch?

    wang wei Newbie

      data display in extendedDataTable, selected the data and click the contextMenu excute the takeSelection(), then open the modalPanel, click the a4j:commandButton 'yes' then
      call removeSelected .But in removeSelected function get the selection size is 0, what is wrong ?

      ------------------------------
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      template="/layout/template.xhtml">
      <ui:define name="body">
      <a4j:region id="a4jRegion">
      <h:form id="searchForm" styleClass="edit">
      <h:panelGrid columns="2">
      <s:decorate template="/layout/display.xhtml">
      <ui:define name="label">Role id</ui:define>
      <h:selectOneMenu value="#{tarUserList.tarUser.tarRole}" converter="#{tarRoleConverter}" style=" width : 100px;">
      <f:selectItem itemLabel="ALL ITEM" itemValue="all" />
      <s:selectItems value="#{pubRoleList.resultList}" var="role" label="#{role.roleName}" />
      </h:selectOneMenu>
      </s:decorate>
      <a4j:status id="waitstatus">
      <f:facet name="start">
      <h:graphicImage value="/img/spinner.gif" />
      </f:facet>
      </a4j:status>
      </h:panelGrid>

      <a4j:commandButton id="search" value="Search" action="#{tarUserList.ajaxRefresh}" reRender="searchResults"/>
      <s:button id="reset" value="Reset" includePageParams="false"/>

      </h:form>
      <rich:panel id="searchResults">
      <h:form id="listForm" style="margin:0 0 0 0;">
      <rich:extendedDataTable id="tarUserList" selectionMode="multi"
      var="_tarUser" selection="#{tarUserList.selection}"
      value="#{tarUserList.resultList}"
      rendered="#{not empty tarUserList.resultList}">
      <rich:column >
      <f:facet name="header">
      <h:outputText value="User id" />
      </f:facet>
      <h:outputText value="#{_tarUser.userId}"/>
      </rich:column>
      <rich:column >
      <f:facet name="header">
      <h:outputText value="User name"/>
      </f:facet>
      <h:outputText value="#{_tarUser.userName}"/>
      </rich:column>
      <rich:column sortable="false" >
      <f:facet name="header">
      <h:outputText value="Role id'}"/>
      </f:facet>
      <h:outputText value="#{_tarUser.tarRole.roleName}"/>
      </rich:column>

      </rich:extendedDataTable >
      <rich:contextMenu event="oncontextmenu" attachTo="searchResults" submitMode="ajax">
      <rich:menuItem value="delete" submitMode="ajax" action="#{tarUserList.takeSelection}"
      rendered="#{tarUserList.resultCount gt 0}" reRender="deletePanel"
      oncomplete="#{rich:component('deletePanel')}.show()" id="delete"></rich:menuItem>
      </rich:contextMenu>
      </h:form>
      </rich:panel>

      </a4j:region>
      <rich:modalPanel id="deletePanel" autosized="true" width="200">
      <f:facet name="header">
      <h:outputText value="Delete Dialog"
      style="padding-right:15px;" />
      </f:facet>
      <f:facet name="controls">
      <h:panelGroup>
      <h:graphicImage value="/img/close.png"
      styleClass="hidelink" id="hidelink" />
      <rich:componentControl for="deletePanel" attachTo="hidelink"
      operation="hide" event="onclick" />
      </h:panelGroup>
      </f:facet>
      <h:form rendered="#{tarUserList.selectedList.size eq 0}">




      <h:outputText value="Please slected the row to delete!"/>




      <a4j:commandButton value="OK" ajaxSingle="true"
      oncomplete="#{rich:component('deletePanel')}.hide();"
      />




      </h:form>
      <h:form rendered="#{tarUserList.selectedList.size ne 0}">




      <h:outputText value="Are you sure?"/>




      <a4j:commandButton value="Yes" action='#{tarUserList.removeSelected}"
      oncomplete="#{rich:component('deletePanel')}.hide();"
      />


      <a4j:commandButton value="No"
      onclick="#{rich:component('deletePanel')}.hide();return false;" />





      </h:form>
      </rich:modalPanel>

      </ui:define>

      </ui:composition>