Flex :: Set SelectedIndex For Flex DownDownList?
Dec 27, 2008I have an Array Collection as follows
myArr:ArrayCollection = new ArrayCollection([
{label: "label1", data: "data1"},
{label: "label2", data: "data2"}]);
[code]....
I have an Array Collection as follows
myArr:ArrayCollection = new ArrayCollection([
{label: "label1", data: "data1"},
{label: "label2", data: "data2"}]);
[code]....
I have an Array Collection as follows
var myArr:ArrayCollection = new ArrayCollection([
{label: "label1", data: "data1"},
{label: "label2", data: "data2"}]);
[Code]....
How to set the selected item for myDDL based on an item id(myID)? I tried something like:
selectedIndex = {myArr.getItemIndex(myID)}
I am unable to bind the selectedIndex public property of a spark DropDownList to it's original source in the view's presentation model.
For the purposes of replicating this issue with as few lines as possible I have two views, and one presentation model. The code follows.
Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
[code]...
Debugging the application I find that selectedIndex in the presentation model always remains at the default value assigned regardless of which item I selected from the DropDownList. For the sample code above this is -1.How can I bind the selectedIndex in the presentation model such that it is updated appropriately when the selected item DropDownList changes?
In the code below, the presentedAlbumIndex is used to control the selectedIndex of the TileList. Item "five" is initially selected. Whenever the button is pressed the first item in the array is deleted, and the presentedAlbumIndex is decremented.
In theory, the selected index should stay with "five" every time the button is clicked (until "five" is itself deleted). It works this way for the first button press. However, on the 2nd button press the highlighting changes to "six" for some reason. Also, the TileList selectedIndex is always one behind.
I tried looking into ListBase and monitoring selectedIndex. It looks like the selectedIndex is updated initially to the correct index, but then it reverts back at some point to the correct index+1. I do not know why it's setting back.
It seems it's due to the fact that I am doing a data provider delete and index change in the same operation.
Is there some function in TileList I could override to keep selectedIndex up to date?
Steve
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
[Code]....
Is there something like selectedIndex for SkinnableDataContainer? It doesn't seem to be one of the available properties.
View 2 RepliesWhen using a dropdownlist in flex I'd like to know the exact index value when the prompt is initialized in it.
View 1 RepliesIsn'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.
I have a simple button function that changes the selectedIndex on a view stack without using the menu bar component. I call the function from the click property on the button and pass an int as the index I want to jump to. When I had the code on the application MXML file everything worked fine. After moving my actionscript to a separate file, I get access of undefined property errors:
protected function changeView(index:int):void
{
myViewStack.selectedIndex = index;
[code].....
I have a simple button function that changes the selectedIndex on a view stack without using the menu bar component. I call the function from the click property on the button and pass an int as the index I want to jump to. When I had the code on the application MXML file everything worked fine. After moving my actionscript to a separate file, I get access of undefined property errors:
protected function changeView(index:int):void
{
myViewStack.selectedIndex = index;
}
How do I get the .as file to recognize the myViewStack component? Do I need to reference Main.MXML somewhere in the .as file? Thanks.
Here is the rest of my code:
<?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"
[code]....
And finally the .as files with the function in question:
import mx.containers.ViewStack;
protected function changeView(index:int, myViewStack:ViewStack):void
{
myViewStack.selectedIndex = index;
}
I am having a real problem with one of my components. I have a list object and I need to set the selectedIndex. Now I would think this would be easy, but it appears that for just this instance the selectedIndex property is read only. I have set the property for other instances, and I can read the property for this instance, but I cannot change it.
View 1 Replieswhen i use nextSlide() and prevSlide(), which are executed when i click on two buttons. SelectedIndex works when i click on the elements in the List. What am i doing wrong? do i have to dispatch some events? Are there any tricks to doing it with buttons?This is my playlist class
public class Playlist extends List
{
private var dispatcher:Dispatcher;
[code]......
I have a viewstack, which contains 3 (at this moment just 1) customcomponents:
<s:Application xmlns:components="components.*">
<mx:ViewStack id="mainViewStack" x="76" y="90" width="800" height="400">
<components:Login />
[code].....
In lee's xml tutorial he uses the list component and the text area component but when he tested the swf he had to select the item befour the text field was populated.
i have set the selectedIndex to 0 but the data still does not load untill an item is selected.
Ok I can't find any doco on this and it's driving me crazy. Anyone know how you specify the default value for the V2 ComboBox component based on the selectedItem when you don't know the selectedIndex? Here's my scenario:
I have a hardcoded combobox called "dd_names" with 50 names in it. I'm returning a dataset into Flash via a SQL query, and onload I need the dd_names dropdown to default to the value of the name returned in the dataset. So if the query returns "Tom" I need the dropdown to default to "Tom."
I tried setting dd_names.selectedItem = "Tom" and dd_names.value = "Tom" and these don't work. The ComboBox just defaults to the first item in the list.However, if I use the selectedIndex property and set dd_names.selectedIndex = 3, the ComboxBox doesn't default to the first item in the list but shows the appropriate item. This doesn't help because I don't know the selectedIndex being returned from the query - I only know the selectedItem. Anyone know how to do this??
I have a DataGrid bound to an XMLConnector and XMLDataSet. The XML data loads fine into the components. However, I cannot get the value of the selected index using: my_datagrid.selectedIndex
The call works fine if you use addItem to populate the grid.
Is there an issue being that the datagrid.selectedIndex parameter is bound to the XML components?
I've got a combo box in my movie (called news_selector), whenever the selection of the combo box changes, I want to do something. Here's my code for the combobox so far...
Code:
on(change)
{
trace("News feed changed to: " +news_selector.selectedIndex);[code].....
The problem is that the news_selector.selectedIndex bit is showing as undefined in the debug window, and thusly the if/else statements are ignored completely.
What's the difference between selectedChild property and selectedIndex property? I read the documentation, both seems to be setting currect active accordion. selectedChild can be only used in actionscript, but other than this, what's the difference?
View 0 Replieswhere I can find info about compiling flex 4.0 sdk on flex 4.5/4.5.1 sdk.I am having troubles. compilation goes well on 4.0 but whe I compile on 4.5 or 4.5.1 I get blank swf.
Note: I have set flash player 10.2 for compilation and also as default.
If I create an object like so:
class Foo {
[Bindable] public var property: String;
}
The class Foo has an implicit event dispatcher to handle property change events. How can I access that without making Foo explicitly extend EventDispatcher?
I wish to develop a softare for 3D object compression (by polygon reduction) in flex using papervision 3D. Could you please suggest me an efficient algorithm for the same?
View 1 RepliesI have implemented application client-server with spring blazeDs message services using JMS message destination. The idea is a producer declared in Java send message using activeMQ and consumer declared in Flex receives them. I have configured the AMFChannel with a polling interval 0, but I have seen when the consumer subscribes to the destination in Flex, the time request can be of up to 3 seconds.
[Code]....
I want to send a html webpage with my application in installation package,is it possible?
View 1 RepliesI have an J2EE Enterprise Application Project in which I would like to add a few Flex screens. How do I go about adding Flex capabilities.
I have build Flex/J2EE applications from scratch but can't think of the best way to do this.
I am currently using Flex Builder Plugin for IBM Rational Application Developer 7.5.
I have a tree with nodes , and a delete button , first user select the node and click this delete button , I want this node to be removed from the tree , Its not XML , every node in tree is of type Object
{label:'folder',children:[{label:'file1'}]}
I tried delete myTree.selectedItem (but compiler wont let me do it) also tried myTree.selectedItem = null (just unselects the item)and also how can I access reference to parent object of myTree.selectedItem ?
im trying to output my database information in a text input field in flex by using remoteObject(cfc). The information is being provided by a database using a query and an array collection. I'm just unsure how i go about taking the queried array collection information and display it into TextInput Fields.
[Code]...
in my variable i am getting error private var friendsList:VBox; "conflict exists with definition friendlist in namespace internal" what it is?
View 1 RepliesI am trying to access html files protected by basic authentication. Below is the code to do that but I still get the authentication dialog. I checked the fiddler and found that for the first request authorization header is present but for the subsequent requests which is requested to load the .js, css & images the authorization header is not added. This is the reason I am getting the auth dialog.
Is there a way to add authorization header to the subsequent requests as well?
[Code]...
I have a TabNavigator, and each tab is a Module. One of the modules is labelled Units and the full code of the module is posted in this post. There are several problems:
1) Forms are not populated with data from the datagrid selection.
2) Selecting a row and clicking delete gives the very-common error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
A trace on the valueObject unit within the selectionChangeHandler function gives NULL. Why? Note: In other modules (other tabs of the TabNavigator), I have DropDownLists populated with units. This means that the valueObject Unit is defined in the other modules. However, valueObjects should be private to modules, and not shared.
[Code]....
ow do you display HTML formatted text in a Spark custom item renderer (Actionscript)?
Sample Code:
The html content in item.post_content displays as plain text in the IconItemRenderer messageFunction snippet below (which is just the default generated code for Icon Item renderer):
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer iconField="iconField"
iconWidth="64" iconHeight="64" labelField="post_title" messageFunction="getPost">
[code]...
I am working on a grid example in flex using advanced grid control. I know we can easily group data by specifying the field name. At the group node level, other than the gorup name I want to be able to show data in the rest of the cells ( calculated data ) and I am looking for some dataRowBound event or similar to be able to hook some data in it.
Example: Grid displaying list of towns grouped by state. At the group level ( for each state) I want to show the total number of towns in each state. Here how can i show the total number in the town column.