0 Replies Latest reply on Sep 8, 2011 3:18 AM by Christian Werner

    h:commandLink with rich:dataTable, problem in pagination

    Christian Werner Newbie

      Hi,

      We are trying to use <h:commandLink> as download-link inside a <rich:dataTable> and we are using <rich:datascroller> for pagination.

      The problem we are facing is that on the first page of dataTable, the links are working fine and the action method is getting called on click of the link.

      But on any of the other pages, when we click the commandLink, the action method doesn't get call.

       

      Page:

        <ui:define name="content">
          <h:form id="ExchangeProtocolForm" styleClass="yform">
          ...
                  <rich:dataTable id="ProtocolList" rows="#{globalSettingAdapter.maxRows}" value="#{exchangeProtocolController}" var="item"
                    rendered="#{exchangeProtocolController.rowCount > 0}">
                    ...
                    <rich:column style="width: 1%; text-align: center;">
                      <f:facet name="header">
                        <h:outputText value="#{messages.exchangeProtocol_label_content}" />
                      </f:facet>
                      <h:commandLink action="#{exchangeProtocolController.processDownloadContent(item)}" rendered="#{item.fileName != null}">
                        <h:graphicImage library="images.buttons" name="download.png" title="#{item.fileName}" alt="#{item.fileName}" />
                      </h:commandLink>
                    </rich:column>
                    <f:facet name="footer">
                      <cmp:dataScroller align="center" listController="#{exchangeProtocolController}" />
                    </f:facet>
                  </rich:dataTable>
          ...
          </h:form>
        </ui:define>
      

       

      Bean:

      @Controller("exchangeProtocolController")
      @Scope(value = IConstants.SCOPE_CONVERSATION_ACCESS, proxyMode = ScopedProxyMode.DEFAULT)
      @ConversationRequire(conversationNames = IConstants.CONVERSATION_EXCHANGE_PROTOCOL, entryPointViewIds = { "/jsp/home/exchangeProtocolList.xhtml" })
      @ConversationName(value = IConstants.CONVERSATION_EXCHANGE_PROTOCOL)
      @ViewController(viewIds = { "/jsp/home/exchangeProtocolList.xhtml" })
      public class ExchangeProtocolController extends FilteredExtendedListDataModel<ExchangeProtocol, String, ExchangeProtocolFilter> implements Serializable,
          InitializingBean {
      
        ...
      
        public void processDownloadContent(ExchangeProtocol protocol) throws Exception {
          setSelectedProtocol(protocol);
          LOG.info("***************** Download **************");
          if (getSelectedProtocol() != null && getSelectedProtocol().getFileName() != null) {
            DownloadHelper.processDownloadStream(getSelectedProtocol().getFileName(), getSelectedProtocol().getFileMimeType(), new DownloadCallback() {
              public void writeToStream(HttpServletResponse response) throws IOException {
                IOUtils.copy(new ByteArrayInputStream(getSelectedProtocol().getFileContent()), response.getOutputStream());
              }
      
            });
          }
          setSelectedProtocol(null);
        }
      
        ...
      
      }
      

       

      We need a resolution. Any help is appreciated.

       

      RichFaces: 4.1.0.M1

      MyFaces: 2.1.0

      Orchestra: 1.4 (Core2)

       

      Thanks in advance.

      Christian Werner