Flex :: Data Binding Not Working
May 3, 2010
I'm having some troubles with binding data. I have an application that contains a viewstack of components. Let's say I have comp1, comp2 and comp3 inside the viewstack. Each component, has its own data class --> comp1Data.as, comp2Data.as and comp3Data.as. All values in each component are binded to the corresponding data in it's data object.
A click in a control in comp1 leads to comp3, the same goes for comp2. Clicking a control in comp2 leads to comp3. When going from comp1 to comp3, comp3Data.as is initialized and and comp3 displays the binded values. When going from comp2 to comp3, comp3Data.as is also initialized but the binded values are not displayed...
[Code]...
View 1 Replies
Similar Posts:
Nov 4, 2011
If user change the value of the TextInput, then click refresh button to retrieve the data model from backend again, the GUI value will not change back. Re-binding not happen, Since the value of data model not changed, no propertyChanged event fired.In this case, I must Programmatically set the model value to the GUI after data refreshing done.I know bi-directional binding can solve this problem(when user change value on GUI, set the new value to data model immediately). But sometimes I cannot use bi-directional binding, for example, the data model is a int, but user input a non-int value, I cannot set the value to data model. So the value in data model do not change, when refresh data, rebinding still not happen.
This will make the data binding useless. How to resolve this?I put pseudo-code here for now, I will put real code later:1. retrieve a data model from server, via blazeds or something else.2. bind the model to a TextInput on GUI.3. user change the TextInput text.4. User click a refresh button, triger retrieve the model value again.5. Now since the model value do not change, no PropertyChanged event fired.6. GUI value still is the user's input, not the value from the model. can clear the model value before set the velue back, make re-binding happen.(but sometimes you do not know how to clean the model value, take int for example, you may do not know the original value and happen set the same value). Or I can manually set the model value to GUI. But both are not good looking.
View 3 Replies
May 13, 2011
For some reason this seems to no longer work in flex 4, it used to work in flex 3.[code]I am setting the xmlTitle variable outside of the component:<local:Comp xmlTitle="Some Title" />I have tried with getter / setters...etc. It just does NOT update when changing, it shows the default value and never changes. Is this a known new bug in flex 4?
View 2 Replies
Oct 8, 2009
first one shows playheadtime of videodisplay and another is also used for same purpose. the difference is that when we are in add mode(decided from a flag variable) both should show current playheadtime using binding. but when we are in edit mode(again decided from flag) the latter label should remain static, to be more specific, the value retrived from database.how can I do that using actionscript. I tried ChangeWathcer but I found it a bit tricky. Is there any other simpler way or am I missing something. following is my code.
private function init():void
{
if (queFlag == 'a')
[code].....
View 2 Replies
Aug 20, 2010
I'd like to add a derived property to flex:[code]However, derived won't update when I change a or b.Is there a better (faster) way to make derived update than giving a and b setter methods which invalidate it?added keyword "get".This makes more sense now, I hope.
View 3 Replies
Nov 23, 2009
I need to bind a property to an edit control and have the control write its value back to the same property. The problem is, I'm setting the source value before the control is created:
<mx:Panel>
<mx:Script>
<![CDATA[
[Bindable] public var editedDocument: XML;
[code].....
View 6 Replies
Mar 30, 2010
I'm using Flex with Cairngorm framework.I have a custom component which I create like this:
<components:FriendSearchPaginator id="searchResultsPaginator"
paginationElement="{_model.findFriendsPaginationElement}"
visible="{_model.friendsSearchResultsPaginatorVisible}" />
Where the findFriendsPaginationElement is inside the model locator:
public var
[Bindable]
findFriendsPaginationElement:PaginationElement = new PaginationElement();
Inside the custom component I have button that uses a property of findFriendsPaginationElement object:
<s:Button id="previousButton"
label=" prev "
click="paginateSearchResults(false)"
enabled="{_model.findFriendsPaginationElement.more_previous}"/>
But I get a warning from Flex that the binding wouldn't work that way and it doesn't. It works the first time I load up the component but every time I change findFriendsPaginationElement it doesn't reflect on the component. Do you know how I can go about doing this? (making changing a value in the binding variable changes the status of an element inside a component?)
View 1 Replies
Jul 21, 2010
I'm binding two AutoCompleteModified objects to one another; meaning you type in one and it selects the correct object in the other. It works fine when I define it in MXML: However, a user can add a new row to a Grid and then I set up the binding and objects via actionscript and it gives an 'undefined' error:
ChangeWatcher line 427/wrapHandler.
var innerHBox:HBox = new HBox();
var dtc_acm:AutoCompleteModified = new AutoCompleteModified();
dtc_acm.dataProvider = data2;
dtc_acm.labelField = 'id';
var cp_acm:AutoCompleteModified = new AutoCompleteModified();
[Code] .....
If I only keep it 1-way binding then it works fine. But both throw this error. Is there something about not only doing it 2-way in actionscript, but adding components that aren't on the stage yet?
View 2 Replies
Oct 1, 2010
Does data binding work with the UITextField? Unfortunately, I'm getting the variable instead of the bound data.
[Bindable]
public var myString:String;
in a function, where tf is a UITextField:
myString = "blah blah blah";
blah blah...
tf.text="{myString}";
It's giving me {myString} instead of its data.
View 1 Replies
Mar 19, 2011
I have a bit of a problem (since I'm not used to binding with AS3), the thing is that I want to do this kind of data binding:
<mx:Application xmlns:mx="[URL]"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
[Code] .....
But the ComboBoxes are being created dynamically with AS3, everything is working except I cant bind the second ComboBox dataProvider to be the XMLList in the first ComboBox's selectedItem.
View 3 Replies
Apr 12, 2012
I have two Datagrid in flex. I am binding data from Datagrid1 to Datagrid2 like
(Datagrid2.dataProvider=Datagrid1.dataProvider as ArrayCollection;)
If I delete Datagrid2 data then automatically another Datagrid1 deleted .
So I don't want delete data in Datagrid1 . how can i do that , But I have other option for delete data to Datagrid1?
View 2 Replies
Sep 15, 2009
In Flex 3, I've created a ComboBox within an MXML component similar to the following:
<mx:ComboBox id="comboBox" dataProvider="{_choices}" />
<mx:Script> <![CDATA[
import mx.collections.ArrayCollection;
// etc...
public function get choices():ArrayCollection { return _choices; }
[Code] .....
In the parent MXML application, I'm modifying the contents of the choices property:
myComponentId.choices.removeAll();
myComponentId.choices.addItem({data: "NY", label: "New York"});
myComponentId.choices.addItem({data: "CA", label: "California"});
// etc...
The binding is working in that the ComboBox is automatically picking up the new contents added at runtime, however it is not adjusting its width. The initial width of the ComboBox is wide enough only to show the initial item "All" declared in the component. However, I want and would have expected the ComboBox to re-size automatically during binding to be able to show "California", but it isn't. How can I get the ComboBox to update its width after I have added new wider labels to its dataProvider?
View 4 Replies
Feb 20, 2010
I have a main.mxml application that lays out my application, it contains a "browse and upload" button. And contains an image to view the users uploaded image like so:
<mx:Application
<mx:Script>
<![CDATA[
[Code].....
In my myModel class I have a img_scld_bm that the browseAndUpload() function draws into after scaling it.
My intent is that my mx:Image will display the image. As shown here I'm assigning the image source="mymodel.img_scld_bm", this ends up just showing a broken image icon.
I also tried data binding, where in my myModel class I have [Bindable] var img_scld_bm. And then tried setting my mx:Image source="{myModel.img_scld_bm}" .. that didn't seem to do anything either. All this compiles fine, no warnings. I think in this case, I'm not setting a trigger or propertyChange event to update the binding?
how to correctly bind an mx:Image source to some bitmap?
View 1 Replies
Jun 8, 2011
class A: with a property "data:ArrayCollection". It's my data source (data provider) and has bitmaps.
class B: has an instance of A (called "Ainst") and calls the following method: C.init( Ainst.data). To pass the data provider to Object C.
class C: has a reference of the data provider "data" (because of "init" method). It shows the arrayCollection into Images as: Image.source = data.getItemAt(0).
But C never updates its images, that is, data binding doesn't work with this scheme. I've put [Bindable] meta-tag in all properties and even classes.
[Code]...
View 2 Replies
Jul 5, 2011
How do you set the selectedColor of a colorpicker when you bind data from a database? I have a bindable variable, objProject, with a field called color and it has a color code such as #ff00ff in it. I want to set the selectedColor. I tried to cast the color as a uint, but no joy.
objProject = cmbProject.selectedItem;
c = uint(objProject.color);
<mx:ColorPicker id="graphColor" x="17" y="219" width="128" height="40"
selectedColor="{c}" editable="true" />
I did try selectedColor="{objProject.color}" and that didn't work either.
View 2 Replies
Jul 27, 2011
i'm using flash builder 4..i want to ask something..how to binding data to custom list component in flex??...i already try binding data from webservice to standard datagrid component in flex, and it's work perfectly...this is my code for binding to datagrid..
<mx:DataGrid includeIn="LobbyPage" x="30" y="319" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{TakeUserResult4.lastResult}">
[code]....
View 1 Replies
Dec 5, 2011
I'm trying to extend ButtonBarButton to include an additional label that shows the number of updates for the respective box in a viewstack (which is the tabbar's dataProvider).
I can get the additional label (named indicatorLabel) to read an initial value from data, but I can't get it to update automatically like the actual "label" attribute. My understanding was that you could bind to the data object, but that doesn't appear to be the case.
[Code]...
View 1 Replies
Jun 23, 2009
Is there some way in Flex where I can tell when all of the data has finished binding to my AdvancedDataGrid? I have a bunch of label functions that run and I need to a busy cursor while the grid gets populated. I then want to remove it when it's all done. And also fire another event.
View 1 Replies
Aug 26, 2009
I have a flex datagrid. it is bound to an array collection. if the user sorts on column X it works fine. then, if the user causes the array collection to change, the datagrid forgets that it was sorted on column X.what do I need to do to preserve this sort preference so that the new array data will appear sorted by column X?
View 4 Replies
Aug 22, 2010
I have a main mxml file (flex4) and want to pass a parameter (user_name) to a component in a directory called components. When I run the program, the user_name is NOT being sent from the main to the component file. (Interestingly, if you make the component visible, you can see the parameter has been passed).
I have hacked much larger files down to get the following two files:
Main
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
[Code] .....
View 1 Replies
May 28, 2011
Assume i have a custom actionscript class. [code]...
Suppose also that i have a different class, that changes a second variable, which has the metadatatag [Bindable]. What methods and events do i have to implement in either of these classes, to make myVariable change, whenever the other is changend?
View 1 Replies
Apr 20, 2011
I have a situation where I need to update a DropDownList's dataProvider and selectedItem in a specific order. See the following code ...
<s:DropDownList id="dropDownList"
dataProvider="{someDataProvider}"
selectedItem="{someSelectedItem}" />
In my case, some user interaction produces new values for the bindable variables "someDataProvider", and "someSelectedItem". However, when flex renders the DropDownList, the control's selected value is empty.
The reason for this is that the DropDownList's "selectedItem" property gets bound before the "dataProvider" property. The "dataProvider" needs to be bound first for "selectedItem" to be valid, this is because the new "selectedItem" points into the new "dataProvider".
what is the best practice for updating bindable properties in a specific order? I've come up with a few ways (e.g. using a valueCommit handler), but I wanted to see what the community had to say.
View 2 Replies
Apr 1, 2012
I have the following code:
<fx:Script>
<![CDATA[
import shared.GlobalsManager;
[code].....
View 1 Replies
Dec 21, 2010
I am migrating an application from Flex 3 to Flex 4. In some cases there are popup windows of which the width and height is bound to the application width and height.
[Code]...
View 2 Replies
Dec 11, 2009
I have a custom ActionScript class:
package EntityClasses
{
import mx.collections.ArrayCollection;[code]....
And I want to bind these values to textBoxes, so that when user types information to the textBoxes it is populated in the class too. Is Flex 3 bidirectional so that marking the class with [Bindable] I can bind the values to a textbox for example?This is my mxml file in which I try to bind the class:
import mx.rpc.events.ResultEvent;
import EntityClasses.CompanyInfo;
[Bindable][code].....
The flex compiler shows me this kind of warnings: Data binding will not be able to detect assignments to "company".
View 4 Replies
Apr 25, 2007
I've been reading up on the Cairngorm architecture that Adobe recommends as best practice for devevloping RIA's in Flex.http:[url].....I recently purchased Flash CS3 and want to find a way to implement Cairngorm in my upcomming RIAs that will be built in Flash instead of Flex. I've created my own version of Cairngorm that uses almost all of the features and classes described in the Cairngorm architecture.
The biggest challenge for developing a Cairngorm architecture in Flash is that the architecturerelies heavily on Flex data binding to update the view when there are changes in the model. As far as I can find, there are no such capabilities built into AS3. This leaves me with a few not-so-desirable options.I could write my own data binding classes, or try to migrate the data binding classes from Flex.
each view class that can respond to changes in the model implements an "IBinded" interface that contains one function called modelUpdated. These classes register with a 'bind list' when they are instantiated, and any command that causes a change in the model also calls a function cycles through each registered view class, calling the 'modelUpdated' function to signify that the model has updated.This is a reasonable solution for a very simple application with very little model data, but as the application increases in complexity, it does not scale, because there is no way for a view class that is binded to an object in the model to know whether or not that object has changed - instead, EVERY view class that responds to changes in the model must check the current value of whatever objects they bind to and see if there has been an update.
View 1 Replies
Oct 13, 2009
Is it possible to specify MXML-esque "binding strings" in ActionScript?For example, I want to be able to do something like:
MXMLBinding(this, "first_item",
this, "{myArrayCollection.getItemAt(0)");
MXMLBinding(this, ["nameLbl", "text"],
[code].....
View 6 Replies
Apr 26, 2011
My application uses fx tag in which it loads some xml. I want to create the xml name by binding, but I get an error that Data binding expressions not supported with attributes processed at compile time.
<fx:XML id="{xml_props}" />
<fx:XML id="{xml_props}" />
View 1 Replies
Jun 2, 2011
I love MXML but am starting to notice some of its drawbacks. The main one I'm struggling with is its larger memory usage due to the need for binding. In the super simple code snippet below, which I've tested on Flex 4.0[code]...
My main question: is there any way to set variables in MXML that doesn't eat up memory? I'm aware that I can do this explicitly in AS and keep MXML as a bare bone structure but was wondering if there was an alternative path.
Secondary question: why memory usage in c different from a and b? I've looked up at the intermediate code and it seems like the const case still sets up some binding logic but not as much and have been wondering why that is.
View 1 Replies
May 2, 2007
how you set up data binding betweenDataSet and Tree component?
View 1 Replies