Yes, addItemAt(0, item) should insert an item at the top of the List.

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Clint Modien
Sent: Thursday, September 01, 2005 5:58 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Strange List behaviour

 

I was jus reading the comments in the DataProvider API and it looks like there is an addItemAt method... (thought there was)

here's the signature...

 

addItemAt(index : Number, value) : Void

 

so instead of

 

var newItemsArray = [ newMsgFromPushData];

listComponentsID.dataProvider.addItemsAt(0, newItemsArray );


it could just be

 

listComponentsID.dataProvider.addItemAt(0, newMsgFromPushData);


 

On 9/1/05, Clint Modien <[EMAIL PROTECTED]> wrote:

It's by design... the dataProvider property of list components only listen to the methods called on the DataProvider API.  Not on the methods called on the objects that act as dataProviders (in this case your array).

 

Sorry about the link I sent before... I didn't realize I had sent the general link to the flex api docs.

 

Here is the specific DataProvider API

 

If you want to update the dataProviders of list controls (without redrawing the entire list each time by reassigning the array) you have to use the methods defined in the DataProvider API.
 

On 9/1/05, Alberto Albericio Salvador <[EMAIL PROTECTED] > wrote:

That worked, I cant imagine why the unshift method was not doing the job.

Thanks Clint.

Clint Modien escribió:

> From the livedocs
> http://livedocs.macromedia.com/flex/15/asdocs_en/
>
> ||
>       |*addItemsAt*
> < http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/listclasses/DataProvider.html#addItemsAt>(
> index: Number, newItems: Array) :  Void
> |Adds several items to the array.
>
>
> so your code might look like this to add data to the beginning of the
> array...
>
> var newItemsArray = [ newMsgFromPushData];
> listComponentsID.dataProvider.addItemsAt(0, newItemsArray );
>
> On 9/1/05, *Alberto Albericio Salvador* < [EMAIL PROTECTED]
> <mailto: [EMAIL PROTECTED]>> wrote:
>
>     Hi all,
>
>     Im using a List component to display the messages incoming from a "msg
>     push server". The dataProvider of the List is bound to "some array
>     variable". If I use the method *addItem* to inject data into the
>     array;
>     as a result of this action, the List grows downwards, leaving the
>     first
>     element always visible and loosing the last added msgs lost (gotta
>     use
>     the scrollbar to find them at the end). Well, I want the List to grow
>     upwards so that the last incoming msg gets displayed the first. I use
>     the *unshift* method but the array does not get modified. So, what is
>     happening here?
>
>     I know this is not a natural Flex question but I cant find why it
>     is not
>     working the way I want.
>
>     Nuke this post if you feel this is not the right place for it and
>     sorry.
>
>     --
>     Alberto Albericio Salvador
>     Aura S.A. Seguros
>     Departamento Informática
>
>
>
>     ------------------------ Yahoo! Groups Sponsor
>
>     --
>     Flexcoders Mailing List
>     FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>     Search Archives:
>     http://www.mail-archive.com/flexcoders%40yahoogroups.com
>     Yahoo! Groups Links
>
>     < http://groups.yahoo.com/group/flexcoders/>
>
>     <mailto: [EMAIL PROTECTED] >
>
>
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "flexcoders
>       < http://groups.yahoo.com/group/flexcoders>" on the web.
>
>     *  To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED]
>       <mailto: [EMAIL PROTECTED]?subject=Unsubscribe>
>
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service < http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>


--
Alberto Albericio Salvador
Aura S.A. Seguros
Departamento Informática



------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
   http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
   [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
   http://docs.yahoo.com/info/terms/








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to