5 Replies Latest reply on Feb 27, 2008 12:31 PM by gjeudy

    Is it possible to add a commandButton per row inside a listS

    gjeudy

      Is it possible to add a commandButton per row inside a listShuttle ?

      For example:


      <rich:listShuttle id="childdomrefshuttle"
      targetValue="#{domRelateInstancesAction.relatedToInstances}"
      sourceValue="#{domRelateInstancesAction.unrelatedToInstances}"
      targetCaptionLabel="Related Ref Domain Instances"
      sourceCaptionLabel="Unrelated Ref Domain Instances"
      fastOrderControlsVisible="false" orderControlsVisible="false"
      listsHeight="300px" sourceListWidth="200px" targetListWidth="200px"
      converter="#{org.jboss.seam.ui.EntityConverter}"
      var="refDomainInstance">
      <h:column>
      <f:facet name="header">
      <h:outputText value="Domain Instance Name" />
      </f:facet>
      <h:outputText value="#{refDomainInstance.description}" />
      </h:column>
      <h:column>
      <f:facet name="header">
      <h:outputText value="Action" />
      </f:facet>

      <h:commandButton type="submit" value="Edit attributes"
      action="#{domRelateInstancesAction.edit(refDomainInstance)}" />
      </h:column>
      </rich:listShuttle>



      I tried the above example but when I click the button on the row nothing happens, the action is not bound to the button. By looking at the HTML source I do see that no javascript event listeners are bound to the buttons.

      As I understand, today its only possible to achieve this using a h:dataTable and/or perhaps a rich:dataTable.

      It would be great if I had this feature in listShuttle which lets me manage a N-N relationship in addition to drill a given item to manage attributes on it.

      Can anyone share in their experience? What is a best fit to implement a clickable(button to action on each row) data list ?

      Thanks,
      Guillaume

        • 1. Re: Is it possible to add a commandButton per row inside a l

          i think you can use <a4j:commandLink> on each row of listshuttle
          example:
          <a4j:commandLink value="test" action="#{TestBean.actionSave}">
          </a4j:commandLink>
          you can give parameters to process for action method of your bean too.
          i try to add button on row like you but it's not active.

          • 2. Re: Is it possible to add a commandButton per row inside a l
            gjeudy

            ok yes this approach seems to work. However my backing beans are already loaded in the listShuttle it sounds like a step backward if I have to pass the id of the object on the command link to access the object details when just passing the object itself would be possible. This would be possible using:

            <h:commandButton value="Edit" action="#{domRelateInstancesAction.editDomainInstanceVO(domInstVO)}"></h:commandButton>


            where domInstVO is the name of the var inside the listShuttle. However this solution doesn't work inside a listShuttle but only inside dataTables.

            I tried invoking a rich:modalPanel from the row and pass parameters in the javascript call but this didnt work because onshow attribute is broken in richfaces 3.1.4. See: http://jira.jboss.com/jira/browse/RF-2201?page=comments&decorator=printable

            Therefore I'm left with the commandLink approach which I don't really like.

            • 3. Re: Is it possible to add a commandButton per row inside a l
              gjeudy

              Note: I'm using Seam 2.0.1GA with richfaces otherwise the extended EL expression you see above would not be possible.

              • 4. Re: Is it possible to add a commandButton per row inside a l

                You can try with <a4j:commandButton>, it is active too with passing parameter. I'm not clear about your work but the button on listshuttle is not nice.

                • 5. Re: Is it possible to add a commandButton per row inside a l
                  gjeudy

                  Thanks xuan, I will try a4j:commandButton.

                  The reason why I'm using the listShuttle is to provide an easy way to relate one or more entities. The button is to edit attributes on any entities no matter the relationship. I figured it would be nicer if all functionality would be available in the same widget otherwise I would have to force the user to navigate to another page with for example a dataTable from which he would be able to edit with regular commandButtons per row.