flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Kessler (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FLEX-33660) ensureIndexIsVisible() does not work for spark.components.List
Date Mon, 12 Aug 2013 22:21:48 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13737442#comment-13737442
] 

Mark Kessler edited comment on FLEX-33660 at 8/12/13 10:20 PM:
---------------------------------------------------------------

I think this will show a bit more about what Alex was mentioning.  Below is a modified version
of your test.  After you add an item to the dataProvider it's not immediately updated in the
List. Calling the validateNow forces it to finish updating before trying to make the newest
/ last item visible.



<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark">

    <fx:Script>
        <![CDATA[
            import spark.core.NavigationUnit;

            private function addMessage():void
            {
                // add the message
                chatList.dataProvider.addItem({label:message.text});

                // clear the text input
                message.text = "";

                //Fixed version
                chatList.validateNow();
                chatList.ensureIndexIsVisible(chatList.dataProvider.length - 1);
            }
            
        ]]>
    </fx:Script>

    <s:Panel title="Chat" defaultButton="{btn}" horizontalCenter="0" verticalCenter="0"
width="300">
        <s:List id="chatList" alternatingItemColors="[#EEEEEE,#DDDDDD]" height="120" width="100%">
            <s:layout>
                <s:VerticalLayout horizontalAlign="justify" gap="0" />
            </s:layout>
            <s:dataProvider>
                <s:ArrayCollection id="dp" />
            </s:dataProvider>
        </s:List>
        
        <s:controlBarContent>
            <s:TextInput id="message" width="100%" />
            <s:Button id="btn" label="Send" click="addMessage()" />
        </s:controlBarContent>
    </s:Panel>
    
</s:Application>

                
      was (Author: paeros):
    I think this will show a bit more about what Alex was mentioning.  Below is a modified
version of your test.  After you add an item to the dataProvider it's not immediately updated
in the List. Calling the validateNow forces it to finish updating before trying to make the
newest / last item visible.



<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark">

	<fx:Script>
		<![CDATA[
			import spark.core.NavigationUnit;

			private function addMessage():void
			{
				// add the message
				chatList.dataProvider.addItem({label:message.text});

				// clear the text input
				message.text = "";

				//Fixed version
				chatList.validateNow();
				chatList.ensureIndexIsVisible(chatList.dataProvider.length - 1);
			}
			
		]]>
	</fx:Script>

	<s:Panel title="Chat" defaultButton="{btn}" horizontalCenter="0" verticalCenter="0" width="300">
		<s:List id="chatList" alternatingItemColors="[#EEEEEE,#DDDDDD]" height="120" width="100%">
			<s:layout>
				<s:VerticalLayout horizontalAlign="justify" gap="0" />
			</s:layout>
			<s:dataProvider>
				<s:ArrayCollection id="dp" />
			</s:dataProvider>
		</s:List>
		
		<s:controlBarContent>
			<s:TextInput id="message" width="100%" />
			<s:Button id="btn" label="Send" click="addMessage()" />
		</s:controlBarContent>
	</s:Panel>
	
</s:Application>

                  
> ensureIndexIsVisible() does not work for spark.components.List
> --------------------------------------------------------------
>
>                 Key: FLEX-33660
>                 URL: https://issues.apache.org/jira/browse/FLEX-33660
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: List
>    Affects Versions: Apache Flex 4.10.0
>         Environment: Flex 4.10.0 and Flash Builder 4.7 on Windows 7
>            Reporter: Alexander Farber
>            Assignee: Mark Kessler
>              Labels: easyfix, easytest
>         Attachments: ScrollToBottom.mxml, ScrollToBottom.png
>
>
> The method ensureIndexIsVisible() does not really work, when an item has been added to
a List recently.
> You have to use workarounds like the one described at the http://flexponential.com/2011/02/13/scrolling-to-the-bottom-of-a-spark-list/
> I am attaching a very simple test case ScrollToBottom.mxml which demonstrates the failure
(and the workaround) for Flex 4.10.0.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message