2 Replies Latest reply on Mar 15, 2011 5:40 AM by Winster Jose

    How to prevent removing an item from target list of listshuttle

    Winster Jose Newbie

      Hi,

      I have a requirement to prevent one item from being removed in target list of listshuttle. Is it possible for me to do that with onremoveclick()?

      If yes, how?

       

      Thanks

      Winster

        • 1. How to prevent removing an item from target list of listshuttle
          Ilya Shaikovsky Master

          please try if the onremoveclick="return false" will works. I believe it should.

           

          But the problem is slightly wider than just using that event I think. Even if you will define like that and it will works - items still can't be moved just by doubleclick on them. So better to play with onlistchange and look to the event to check which item now trying to be moved.

          • 2. How to prevent removing an item from target list of listshuttle
            Winster Jose Newbie

            Thanks Ilya. Please find the following.

             

            1. I tried onremoveclick(). return false doesnt prevent removing the item.

            2. As you said, user can double click to remove the item. I tried return false for onlistchange. Even that didnt work.

             

            I have done a kind of hack to resolve this.

             

            <a4j:support event="onlistchanged" action="#{Bean.onListChanged}" oncomplete="moveBackItem()"/>

             

            Above event listener, will give a control at the backing bean. By that time, item should have reached the available items. Do a search there, add back to selected items and remove from available items.

             

            I am not satisfied with my work. But I couldnt any other way. Already spent 4 to 5 hours on this.

             

            Do you have any thoughts on this?