4 Replies Latest reply on Sep 14, 2009 8:17 AM by Olli H.

    Creating the HtmlListShuttle component dynamically

    Olli H. Newbie

      Hi,

      i tried to implement the shuttleList dynamically. For targetSource i used a list of SelectItems. I think this should work, but the targetList if the Shuttle is empty.

      So what is wrong with that code.....
      Regards,

      Kalomo

      List<SelectItem> selectItems = new ArrayList<SelectItem>();
      
      HtmlListShuttle list = new HtmlListShuttle();
      list.setTargetListWidth("160");
      list.setSourceListWidth("160");
      
      //Converter is never been called ??? Why?
      list.setConverter(new ShuttleConverter());
      
      List<SelectItem> selectItems = new ArrayList<SelectItem>();
      
      //is called 10times
      for (Item item: itemList) {
       selectItems.add(new SelectItem(item.getField(),item.getLabel()));
      }
      
      list.setSourceValue(selectItems);