0 Replies Latest reply on Mar 11, 2010 5:08 PM by lenyas66

    Access of listShuttle target values via Java script

    lenyas66

      Could somebody tell me how I could access targetValue list for rich:listShuttle from Java script?

       

      I am curious, if I could use the values from that list to populate another h:selectOneMenu component.

       

      So, each time the item is moved (removed) to the target screen I want it to be added (deleted) to the list of options for that element.

       

      I could do it via the server call on , but then there is a problem with required message logic (it shows it after I remove the last item from target).

       

      a4j:support event="onlistchanged" action="#{qtBeanParam.updateSort}" reRender="sortingPanel"

       

      So, I am trying to see, if I could do instead via Java script. For example, as follows:

       

      onlistchanged

       

      ="populateSortPeriods()"

      ...

      function

       

       

      populateSortPeriods() {

       

      var sortPeriod = document.getElementById('piPerformanceReturnsForm:sortPeriod');

       

      var trailPeriod = document.getElementById('piPerformanceReturnsForm:selectTimePeriods');

      sortPeriod.options.length = 0;

       

      for (var i=0; i < trailPeriod.targetValue.length; i++)

      {

      sortPeriod.options[i]=

      new Option(trailPeriod.targetValue[i].text, trailPeriod.targetValue[i].value);

      }

      }

       

      Problem is I don't know how to access items from target list.