1 Reply Latest reply on Aug 23, 2010 10:07 AM by Deepak S

    List Shuttle Customization!!!

    Deepak S Newbie

      Hello All,

       

      I'm using list shuttle in my xhtml page..  It is working fine from the functionality perspective...

       

      Now the business requirement is to display both the source and target list in sorted order always...

       

      Actually i'm using 2 column display lets say, firstName and lastName...  Now the requirement is the list displayed in the source list should be sorted in firstName-lastName (ascending) and whenever user selects from source to target; even the target list needs to be displayed in sorted order... Is it possible to achive this effect from this component.... please guide me...

       

      Thanks in Advace..

       

      Deepak

        • 1. Re: List Shuttle Customization!!!
          Deepak S Newbie

          Hello All,

           

          Within the tool's configuration i dont have no idea how to do the sorting.

           

          But i have found a workaround to do that.  I'll add Comparable<XYZ> to the entity XYZ.  I just need to implement one method compareTo() which will do proper comparison.

           

          So it'll look like

          class XYZ implements Comparator<XYZ> {

          ....


          @Override
              public int compareTo(XYZ newObj) {
                  int xyzCmp = firstName.compareTo(newObj.firstName);


                  return (xyzCmp!= 0 ? xyzCmp: lastName.compareTo(newObj.lastName));


              }

          }

           

          I can call a method on the pageForm which will sort the lists:

           

          public void sortXYZLists() {
                  List<XYZ> sourceList = getSourceXYZList();
                  Collections.sort(sourceList);
                  setSourceXYZList(sourceList);


                  List<XYZ> targetList = getTargetXYZList();
                  Collections.sort(targetList);
                  setTargetXYZList(targetList);
              }

           

          But now the problem is to trigger the action on the buttons provided on the listshuttle tool.  Can we trigger some action when they click on 'Copy All' or anyother button.  Please let me know how to add actions to the buttons.

           

          Thanks
          Deepak