6 Replies Latest reply on Mar 27, 2011 2:08 PM by flexillu10

    List Scrollbar not appearing

    flexillu10 Level 1

      I have a spark list with a data provider property that changes often, if the list only has a few items in it no vertical scrollbar appears as expected.

       

      However when the data provider changes the vertical scrollbar doesn't always appear automatically meaning i cann't view all the items in the list.

       

      Is there anyway to force a scrollbar to display?

        • 1. Re: List Scrollbar not appearing
          miguel8312 Level 3

          i'm not sure that this is your issue but it might make sense to refresh

          the ui.

          Maybe you need to do something like this.

           

          yourcomponent.InvalidateDisplayList


          miguel

          • 2. Re: List Scrollbar not appearing
            flexillu10 Level 1

            Thanks for your reply but its not solved the problem.

             

            If happens specifically when the list is loading a data provider that fits in the visible area of the list and i change the data prvider quickly to a data provider that requires a scrollbar.

            • 3. Re: List Scrollbar not appearing
              Flex harUI Adobe Employee

              If the renderer doesn't report measuredHeight correctly, that can result in

              issues.  For example, if the renderer is just a BitmapImage and the data is

              a loaded asynchronously, the measuredHeight will be 0 until the image loads

              which is too late for the scrollbar computation.

               

              If you set preliminaryHeight on the BitmapImage it will measure better.

              • 4. Re: List Scrollbar not appearing
                flexillu10 Level 1

                I've posted my code below for my Item renderer. Tried setting a minwidth and min height but that didn't work.

                 

                It happens when the dataProvider only has a few items in which doesn't need a scrollbar. If i quickly change to another dataProvider that does need a scrollbar, the problem occurs and a scrollbar does not appear.

                 

                It also happens in reverse. If a dataprovider is chosen that needs a scrollbar, one appears. But then if i quickly change to a dataprovider that doesn't need a scrollbar, the previous scrollbar is still there, until i try to click it, then it disappears.

                 

                 

                 

                 

                <?xml version="1.0" encoding="utf-8"?>
                <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                    xmlns:s="library://ns.adobe.com/flex/spark" 
                                    xmlns:mx="library://ns.adobe.com/flex/mx" 
                                    autoDrawBackground="false" width="300" height="300" xmlns:local="*">
                     
                     
                     <s:states>
                          <s:State name="normal"/>
                          
                          <s:State name="selected"/>
                          
                     </s:states>
                     
                     <s:BorderContainer borderVisible="true" borderColor="black" width="100%" height="100%" borderStyle="solid" left="5" right="5" top="5" bottom="5">
                          
                          <s:CheckBox id="checkbox" selected.normal="false"
                                    selected.selected="true"/>
                
                          <mx:Image id="thumb" horizontalCenter="0" verticalCenter="0" source="{'http://someserver.com/folderA'+data.filePath+data.fileName+'.png'}"/>
                     
                     </s:BorderContainer>
                     
                     <fx:Script>
                          <![CDATA[
                               import flashx.textLayout.factory.TruncationOptions;
                               import mx.events.FlexEvent;
                               import mx.events.ItemClickEvent;
                               
                               protected function thumb_clickHandler(event:MouseEvent):void
                               {
                                    var ev:ItemClickEvent = new ItemClickEvent(ItemClickEvent.ITEM_CLICK, true);
                                    ev.item = data;
                                    ev.index = itemIndex;
                                    dispatchEvent(ev);
                               }
                          
                          ]]>
                     </fx:Script>
                     
                </s:ItemRenderer>
                
                • 5. Re: List Scrollbar not appearing
                  Flex harUI Adobe Employee

                  The mx:Image is probably messing things up.  It doesn't know its size until

                  too late.  If you know the size or approximate size of the images, set that

                  size on the mx:Image

                  • 6. Re: List Scrollbar not appearing
                    flexillu10 Level 1

                    the image size is not consistent, i tried min width and minheight and had some luck, but they images load small then get bigger after a short delay.

                     

                    Messes up  the rest of the UI so that's a no go