1 Reply Latest reply on Nov 27, 2009 10:59 AM by Jagannatha Revanna

    Issue with rich:listShuttle component

    Jagannatha Revanna Newbie

      Requirement Details :
      User chooses any item from Source list of a list-shuttle component and when click on item link /'View' button (new custom control) user should be able to navigate to next page(details page).

      Issue Details:
      The component rich:listShuttle allows to select items(s) with move/reorder controls from source list to target list. Currently, we believe there is no option to add new custom control in list-shuttle component that can be used to obtain selected item (from source-list) object in backing bean.

      We used s:link for all the source list items. Upon selection of any item from source list, item object value should be available in backing bean method. However in the following example the item object is always null in viewSelectedItem() method of UIListItemWebBean.

      <rich:listShuttle id="offerShuttle" sourceValue="#{manager.availableItems}" targetValue="#{manager.selectedItems}" sourceCaptionLabel="Available Items"
      immediate="true" var="item" targetCaptionLabel="Included Items" copyAllControlLabel="Add All" copyControlLabel="Add" binding="#{UIListItemWebBean.selectedItem}">

      <h:outputText value="#{item.name}" />
      <s:link action="#{UIListItemWebBean.viewSelectedItem()}" value="#{item.name}" />
      <h:outputText value="#{item.reference}" />

      In backing Bean

      public class UIListItemWebBean {

      private HtmlListShuttle selectedItem;

      // getter and setter methods available for selectedItem attribute.

      public void viewSelectedItem() {
      log.debug( "inside UIListItemWebBean.viewSelectedItem() method"+ getSelectedItem());
      if (getSelectedItem()!=null){
      Object Item = getSelectedItem().getActiveItem();
      log.debug( " the value of selected offer object: " + Item);
      item = (Item)((UIListShuttle)getSelectedItem()).getActiveItem();
      log.debug( "getSelectedITem() returns null");



      Alternatively we used 'View' button instead of s:link option for each item. e.g
      <a4j:commandButton value="View" ajaxSingle="true" action="#{UIListItemWebBean.viewSelectedItem}"/>

      In all the cases, we are unable to obtain selected Item from list-shuttle in backing bean method. The value is always null.

      Please let me know if I am missing something here. Thanks for all the help in advance.