6 Replies Latest reply on Aug 5, 2010 1:59 AM by ilya_shaikovsky

    listShuttle movement of items erratic?

    berndpixel

      In my rich:listShuttle the movement of the selected items is not working correctly. Sometimes it moves the selected items but very often it moves all, and sometimes a subset of the items but not only the selected. I verified serveral times that I realy selected only one item but all were moved.

       

      I am usin g RichFaces 3.3.3-FINAL Release.

      What could be the reason?

       

      Firebug shows an error in the status bar: item is null. Line 14 in ListSuttle.js.jsf

      Line 14:

      select u from com.cheil.sfo.persistence.data.User u, com.cheil.sfo.persistence.data.Authority a where a.id.username = u.username and a.id. = 'ROLE_ADMIN'
      this.addItem(targetComponent,item);this.removeItem(sourceComponent,item);},removeItem:function(component,item){var items=component.shuttleItems;component.selectedItems.remove(item._node);items.remove(item);if(item==component.activeItem){component.activeItem==null;}},addItem:function(component,item){item.doNormal(Richfaces.getExternalClass(item.rowIndex),component.columnClasses);component.shuttleTbody.insertBefore(item._node,null);component.shuttleItems.push(item);},tableUpdate:function(component){var table=component.shuttleTable;var tbody=table.tBodies[0];var newTbody=tbody.cloneNode(false);table.removeChild(tbody);table.appendChild(newTbody);component.shuttleTbody=table.tBodies[0];},moveItemByClick:function(event,sourceComponent,targetComponent,layoutManager){if(Richfaces.invokeEvent(this.events.onlistchange,this.container,"rich:onlistchange",{sourceItems:sourceComponent.shuttleItems,targetItems:targetComponent.shuttleItems})){var item=this.sourceList.getEventTargetRow(event);this.moveItem(sourceComponent,targetComponent,item);this.controlListManager();if(this.targetList.controlListManager){this.targetList.controlListManager();}

        • 1. Re: listShuttle movement of items erratic?
          berndpixel

          Please ignore the first line in the documented firebug log message of line 14. I accidently copied also a line which has nothing to do with this problem.

           

          So line 14 is:

          this.addItem(targetComponent,item);this.removeItem(sourceComponent,item);},removeItem:function(component,item){var   items=component.shuttleItems;component.selectedItems.remove(item._node);items.remove(item);if(item==component.activeItem){component.activeItem==null;}},addItem:function(component,item){item.doNormal(Richfaces.getExternalClass(item.rowIndex),component.columnClasses);component.shuttleTbody.insertBefore(item._node,null);component.shuttleItems.push(item);},tableUpdate:function(component){var  table=component.shuttleTable;var tbody=table.tBodies[0];var  newTbody=tbody.cloneNode(false);table.removeChild(tbody);table.appendChild(newTbody);component.shuttleTbody=table.tBodies[0];},moveItemByClick:function(event,sourceComponent,targetComponent,layoutManager){if(Richfaces.invokeEvent(this.events.onlistchange,this.container,"rich:onlistchange",{sourceItems:sourceComponent.shuttleItems,targetItems:targetComponent.shuttleItems})){var   item=this.sourceList.getEventTargetRow(event);this.moveItem(sourceComponent,targetComponent,item);this.controlListManager();if(this.targetList.controlListManager){this.targetList.controlListManager();}

          • 2. Re: listShuttle movement of items erratic?
            ilya_shaikovsky

            http://livedemo.exadel.com/richfaces-demo/richfaces/listShuttle.jsf - do you able to reproduce there?

             

            if no - please:

            1) check if there are any external js libraries added to the page - maybe them conflicts with our code base.

            2) show your code

            • 3. Re: listShuttle movement of items erratic?
              berndpixel

              Thank you for your immediate reply.

               

              I thougt it would the cause would be a mismatch of JavaScript libraries,too, but the cause of this strange behaviour was

              the composition of my page.

               

              I had the same problems with picklist uand shuttleList - with minor differences.

               

              The picklist was unnecessarily wrapped in a h:panelGroup. After I removed this, the problems were gone.

               

              For the shuttleList this was not enough. It was still in a a4j:outputPanel with layout = 'none'. I thought that would be necessary because the shuttleList is rendered conditionally. For the shuttleList to work correctly I had to remove this panel too. Now it works!

               

              The outest surrounding block is a4j:outputPanel with ajaxRendered='true'.

               

              If I learned my lesson right, than a4j:outputPanel layout='none' must not be used with rich tags but only standard jsf tags.

              Is that right?

              • 4. Re: listShuttle movement of items erratic?
                ilya_shaikovsky

                If I learned my lesson right, than a4j:outputPanel layout='none' must not be used with rich tags but only standard jsf tags.

                 

                No, In general we have no such restrictions.

                We had some issues in the past like https://jira.jboss.org/browse/RF-3978 and https://jira.jboss.org/browse/RF-2238 and https://jira.jboss.org/browse/RF-3896 but all of them are closed. So if you using latest version and see such issues just because of that component - please rise one more issue with sample code.

                 

                Thanks for your efforts!

                • 5. Re: listShuttle movement of items erratic?
                  berndpixel

                  Thanks Ilya,

                   

                  I will raise an issue with the sample code.

                  I don't have the time to reconstruct that malicious code right now, because I have to finish my project in time.

                  I will post it end of next week.

                   

                  Bernd

                  • 6. Re: listShuttle movement of items erratic?
                    ilya_shaikovsky

                    good to hear and thanks again for all your efforts.