Flex :: Reverse Order Of ArrayCollection So That The Last Item Appears First In A ComboBox
Jan 26, 2011
Is there a way to reverse the order of the items in a comboBox? I'd like to use index numbers to refer to items in the arrayCollection below. I want the newest content to appear first in the comboBox. But, if I add something above the first item then all of the index numbers will be off by one. If I could add a new item to the end of the arrayCollection, but have it appear first in the comboBox drop down that would solve a lot of problems.
[Code]...
View 1 Replies
Similar Posts:
Mar 16, 2011
How can I validate there's a selected item in a ComboBox before saving? If there's no selected item, how can I set focus on the ComboBox?
View 2 Replies
Oct 14, 2009
I'm trying to use a BarChart in Flex. I'd like it to order the bars according to the order of the ArrayCollection I fed it. i.e. data at index 0 should be the first bar on top.However, Flex is giving me the exact reverse order. i.e. data at index 0 is not the last bar in bottom. How could I tell the BarChart to reverse the order other than reversing the order of my ArrayCollection?Here's the block of code in my script tag:
[Bindable]
private var optionsArray:ArrayCollection = new ArrayCollection([
new VotingOption('Yes, it rocks!', 'yes', 5),
[code].....
View 2 Replies
Jul 4, 2009
I'll show you the function first.[code]As you see, the order i put the items in the ArrayCollection is Areal, then Verdi (area, value)When i loop through the collection later, the order changes. Now it is Verdi then Areal (value, area).Does anyone have an idea of what might be the problem?It really ruins things when I pass it over to a PHP-script for table-making in html later.(I have several different dynamic DataGrids that differs in size and "values", so I can't really point directly to f.ex "Areal" in my PHP-script)And by the way, does anyone know how i can remove that pesky mx_internal_uid?
View 1 Replies
Sep 22, 2010
My goal is to create a generic function that selects a value in a combobox according to a value. (My comoBox holds arrayCollection as dataProvider.) The difficulty is infact to get a propertyname in runtime mode.
public function selectComboByLabel(combo:ComboBox , propetryName:String, value:String):void {
var dp:ArrayCollection = combo.dataProvider as ArrayCollection;
for (var i:int=0;i<dp.length;i++) {
if (dp.getItemAt(i).propertyName==value) {
combo.selectedIndex = i;
return;
}}}
The line if (dp.getItemAt(i).propertyName==value) is of course incorrect.
It should be arther something like: dp.getItemAt(i).getPropertyByName(propertyName)
View 2 Replies
Aug 11, 2010
I use this arrayCollection to populate a Flex 3 Datagrid. I'd also like to use this arrayCollection to populate a comboBox with the Name node.
In the arrayCollection, I've got the Name listed twice. I've got two rows in the Datagrid.
If I set the ComboBox's labelfield to Name, then the Name will be listed twice in the ComboBox menu. Is there a way to use this arrayCollection and have each Name listed only once in the comboBox?
I can always make another loop and array collection for the Name, but I was wondering if there were a better way.
var i:uint;
for (i=0; i<myArray.length; i++){
myDGArray = [
[Code]....
View 1 Replies
Mar 21, 2010
is it somehow possible to get item's depth in ArrayCollection?
View 3 Replies
Nov 10, 2009
[code]...
Here am getting array of groups(groupName,GroupID each row ) from a RemoteObject and displaying in a ComboBox. I am selecting the groups with selectedIndex as 0,1,2,3, but I want my groupIDs of correspoding groupnames,which am bringing to client side.
How can I get actual the groupId of the selected group?
View 1 Replies
Aug 11, 2010
My first issue is that when my ArrayCollection only has one item, for some reason I cannot select that first item. The change function set on the mxml never gets called when I try to select that one item. If I set a prompt, it works. I know that the item is not already selected because when debugging, the selected item shows null. I do not want to use a prompt. I want the first item in the ArrayCollection to be selected automatically. So if there is only one item, I want the selected item to be that. FYI - I am using a labelFunction to format the data in the Array Collection. why I cannot select the first item or set the first item in the ArrayCollection to be the selected item?
My bigger issue is that when my Array Collection gets updated, my label function must not be refreshing because when I first open the dropdown, it has specfic data. When the Array Collection gets updated and I open the dropdown again, I see the old data in the dropdown, yet it doesn't exist anymore.
So let's say I have a ComboBox that has a datasource of an array collection of one state code and it's state name. Their is a labelFunction that puts a dash in between the state code and the state name. Their is no prompt, so the ComboBox would look like GA - Georgia and when you open the dropdown, that would be all that is there. I want that item to be selected automatically. why the old data shows up when opening the dropdown after the array collection was updated with new data?
<mx:ComboBox labelFunction="getFormattedNpaNxxCollectionList()"
dataProvider="arrayColl" change="doSomething()"/>
public function getFormattedNpaNxxCollectionList(item:Object):String
{
return StringUtil.substitute("{0} - {1}", item.stateCode, item.stateName);
}
View 1 Replies
Mar 7, 2012
I am developing a panel in Photoshop with Flex and Extendscript. I am pretty close to getting this to work, but with my Flex skills I am having a little issue with the Array I am pulling in from the jsx file. The array is displayed fine in the alert box, but somewhere between my split and creating new collection something is wrong.
Here is my Flex
protected function loadData():void {
var grabFolderNames:SyncRequestResult = CSXSInterface.instance.evalScript("labNames");
var list:String = grabFolderNames.data;
[Code]....
View 2 Replies
Nov 27, 2009
I have an ArrayCollection with values predefined. I want to assign a new value to items in the arrayCollection but can not figure out how. Basically I want to do something like this:acGuages.itemUpdated(0).thevalue = 90; (Changing the value from 25 to 90)
private var arrayGuages:Array=[
{thevalue:"25",height:"115"},
{thevalue:"45",height:"115"},
[code].....
View 1 Replies
Jun 16, 2011
I use a spark List with a custom item renderer and an ArrayCollection for dataProvider.
The ItemRenderer looks something like
<mx:TextInput id="txtValue1" text="{data.myFirstValue}"/>
<mx:TextInput id="txtValue2" text="{data.mySecondValue}"/>
However, even though I change the text in txtValue1 or txtValue2, those are not actually changed in the object inside the ArrayCollection.
myFirstValue and mySecondValue are decorated with the [Bindable] tag.
My understanding is that if the text property is set to be bound a certain property, the changes should be automatically applied.
So the HACK (or so I think) that I use is to listen to the focusOut event of each textbox, and access the parent data provider and set the the values manually.
View 1 Replies
Oct 14, 2009
I have some XML structures like this:
var struct:XML = <mh>
<mi id="1" stuff="whatever"/>
[Code]....
I wonder if items can be accessed in a similar way, like this:
var stuff:Object = cmenu['id == 2'].stuff;
View 8 Replies
Mar 22, 2010
I have an ArrayCollection where I want to be able to bubble items up or down by one position. What is the best way to do this?
View 2 Replies
Jul 27, 2011
i got an Arraycollection which holds other arrays in it.i want to display the data inside with an item render but cant manage to do this
here is example code to explain my question
<s:DataGroup dataProvider="{news}"
itemRenderer="components.displaynews">
and this is the item render
<s:Label text="{data.??/}"/>
now what i dont understand is what comes after data? in the array collection the data goes like this : myArrayCollection->[0]->firstname
so when im binding data to item render,how do i represent the [x] to get to the specific name that i want? this obviusly wont work
<s:Label text="{data.[0].name/}"/>
and one more thing is what is the lightest way to display data in a listgroup with simple item render (image and text)
private function convertFBEventData2TreeData(eventData:Object):Object
{
var children:ArrayCollection = new ArrayCollection();[code].....
i dont know what to add after data, i tried many things but nothing work :
View 1 Replies
Sep 12, 2011
I have ComboBox With ArrayCollection as DataProvider. Data will come from Databse as ArrayCollection. I'm Adding Item to ArrayCollection "-Select Item-" at 0th index and setting selected index=0 for combobox.
View 2 Replies
Oct 17, 2011
I have a regular spark list which is sorted correctly when no item renderer is used. However, when the following item renderer is used, the list shuffles and displays items from previous instances of the list.[code]
View 2 Replies
Jun 4, 2011
I have a combobox with arrayCollection dataprovider, it selects nothing at start, but i see the first object label as selected, i want to add select text, as first option that selects nothing, just to indicate that the user didn't select an option yet.
View 1 Replies
Dec 10, 2009
I am using a combobox for the us states, link. The label is set to the full name of the state, while the value attribute holds the abbreviation. What I want to do is to get the selected item's value. So I tried combo.selectedItem.value and combo.selectedItem.@value, but neither of them worked.
View 2 Replies
Apr 7, 2010
I'm using the <s:ComboBox> flex component which I suspect is very similar to the mx one <mx:ComboBox>
What I'm trying to do is listen to the event of the mouse moving between the items of the list. There's a change event, but it kicks in only when the item is clicked/selected from the list.
What event would I need to listen for when items are just hovered over. I tried finding over and hover but couldn't find something to that effect.
View 1 Replies
Jul 20, 2010
I am in search of finding a way to display shopping cart items in a flash 8 datagrid in the order it was chosen by the user & also to ability to delete an item if the user choses. Currently I have the items displaying however they are displaying in a position as it is stored and called in the array. [code]
View 5 Replies
Sep 16, 2010
I've been playing with s:ComboBox and generally like them a lot. One detail is driving me nuts though - most likely due to my lack of knowledge in the subject - is that if I try to add a new item to my dataprovider in a changeHandler (registered to the change event) the text for the ComboBox textInput disappears - although the item addition works perfectly. Interestingly enough the same operation works fine if it gets called by clicking on a button, i.e. post the change event has been processed, and the text does not disappear.[code]if you take out the change handler you will see that adding a new item and then clicking on the button keeps the new element in the textInput while adding the item to the data provider, which does not happen if you just enter a new item and press enter.
View 1 Replies
Jan 26, 2011
I need to programmatically set the selected item in a combobox. I've got a combobox like this:
<mx:ComboBox id="MyComboBox" change="puzzleHandler(event);"prompt="Make a Selection">
<mx:ArrayCollection id="myDP">
<mx:Object id="first" label="Label 1" series="2" pageTitle="Title 1"/>
<mx:Object id="second" label="Label 2" series="7" pageTitle="Title 2"/>
<mx:Object id="third" label="Label 3" series="9" pageTitle="Title 3"/>
</mx:ArrayCollection></mx:ComboBox>
I've got a function that regards deep linking. [URL]. They'll be taken to the appropriate part of the site (without having selected Label 2 in the comboBox). How do I set the comboBox programatically, so that it corresponds with what the user it looking at? In my function's switch statement, I want to set the comboBox to the label that corresponds with the view. If "view=2" then the comboBox should show "Label 2" as selected.
case "view=1":
MyComboBox.selectedItem.label="Label 1";
parseUrl();
case "view=2":
[Code] .....
I tried this: MyComboBox.selectedItem.label="Label 1" But it's not working.
View 1 Replies
Jun 27, 2011
issue is that when a user clicks a datagrid cell that has a combobox editor and then immediately clicks away from the cell, the text value in that cell disappears. I have an itemEditEnd handler on the datagrid and it shows the value of the property I use as the editorDataField just fine. But the labelFunction (which gets called after the itemEditEnd handler) on that grid column sees it as zero. Why aren't the labelFunction and item editor playing together nicely? Here is the DataGridColumn:
[Code]...
View 1 Replies
Nov 24, 2009
I need to know how to show current item as tool tip in ComboBox itemRollOver event at present i am using the below code,
private var tip:ToolTip
private function ItemRollOver(event:ListEvent):void
{[code]...........
when i click the item or itemRollOver faster tool tip is not destroyed some time.
View 1 Replies
Mar 30, 2010
I've just recently started out using Flash Builder and have a question surrounding states. In fact I'm not entirely sure it is related to states but read on and I hope it will become clearer. I currently have a custom component that contains 3 comboboxes. This resides in a TabNavigator component. The TabNavigator consits of 5 pages (Tabs). The custom container holding the comboboxes should display the same selected data across all Tabs. ie. If I am in Tab1 and select an item from one of the comboboxes then click on Tab2 I need to mirror the combobox's selection in Tab2.
View 1 Replies
Jun 21, 2010
Isn't there a better way to accomplish this?[code]...
All I want to do is make sure that when I update the item that the comboBox is pointing to internally, that it's selectedIndex also update so that the label within the ComboBox reflects the new value.
View 1 Replies
Mar 3, 2011
I have a combobox that act as autosuggestion for a search application. Search function is getting triggered by a search button. I also want to trigger the search function either when the item in combobox is double or single clicked. Code:
[Code]..
View 2 Replies
Apr 12, 2011
In a flex application how to display default selecteditem from the dataprovider of the combobox.
I'm using {staticdataholder.currencylist}.
For example: I have to show INDIA so it should be selected as default from the list.
View 2 Replies
Sep 3, 2009
I have a ComboBox with a label function like this one:
private function fieldLabelFunction(item:Object):String {
return resourceManager.getString('dashboard',"SS." + item);
}
When I change locales, the labels display correctly in the ComboBox's dropdown list, or if I change a selection. However, the currently selected item's label doesn't refresh at first. Is there a way to force the labelFunction to get called again?
View 1 Replies