Summary:
Data binding is among the most common UI programming tasks. Although the open-source Flex framework has supported data binding since its inception, the latest Flex 4 SDK adds two-way data binding as well. This tutorial illustrates two-way data binding in Flex 4.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: August 6, 2010 8:56 PM by
Loren
|
Data binding is among the most common UI programming tasks. Although the open-source Flex framework has supported data binding since its inception, the latest Flex 4 SDK adds two-way data binding as well. This tutorial illustrates two-way data binding in Flex 4. http://www.artima.com/articles/two_way_binding.htmlWhat do you think of the approach to data binding presented in the article?
|
|
|
Data [Binding] is evil 'magic' and should be avoided by anyone who can program a solution instead. I realize this needs to exist for the non-programmers, but anyone who has an alternative should use it (if you want to have scalable and maintainable code) --- this comment arises from bitter experience of debugging [Bindable].
|
|
|
> Data [Binding] is evil 'magic' and should be avoided by > anyone who can program a solution instead. I realize this > needs to exist for the non-programmers, but anyone who has > an alternative should use it (if you want to have scalable > and maintainable code) --- this comment arises from bitter > experience of debugging [Bindable].
I would be interested in hearing more about this. Data binding seems to be a key language feature for Flex - perhaps the single most important feature from a UI standpoint. What sorts of debugging issues have you seen with it?
|
|
|
> Data [Binding] is evil 'magic' and should be avoided by > anyone who can program a solution instead. I realize this > needs to exist for the non-programmers, but anyone who has > an alternative should use it (if you want to have scalable > and maintainable code) --- this comment arises from bitter > experience of debugging [Bindable].
I assume you're only referring to Flex here and not Data Binding in general because Data Binding in .NET 3.x / WPF is pretty good and a key feature.
|
|
|
Yes, I am only referring to Flex.
|
|
|
I have several times debugged problems where a 'cascade' of [Bindable] was used --- one [Bindable] triggers another [Bindable] etc., the final bindables were used to control features of columns in an advanced data grid. If you trace [Binadble] through the debug player, you will see that it does a 'LOT' of work. With a complex enough situation the Flex runtime can take longer than the server timeout (30 minutes) to return.
I have many situation with complex usage of [Bindable] that do work, but there is a limit to how complex the usage can be.
In the situations where I had problems, simply removing [Bindable] and explicitly setting values solved the problem.
I find that often [Bindable] is simply used as the 'easiest way', which is fine in small applications, but in a large 'mission critical' application you can get into a very difficult to detect problem, which if the code is being maintained months after it was written or being maintained by someone other than the original coder can be problematic.
|
|
|
Having only glanced at binding in WPF, how is it any different? It appears that both Flex and XAML provide binding as a short cut to coding repetitive methods that handle data changes.
|
|
|
Hello, I'm quite familiar with Eclise Data Binding framework: http://wiki.eclipse.org/index.php/JFace_Data_Bindingbut quite new to Flex. IMHO beside converters, a complete data binding framework requires the following features: - onChange validation - ability to track the validity status of multiple fields within a form to know if the whole form is valid or not. Can you give to hints if those feature are available in Flex 3 or will be available in Flex 4 ?
|
|
|
Is this supposed to work for binding between AS and MXML objects? For example, I have an AS object like this:
public class Foo { [Bindable] public var bar:String; }
and an MXML class like this (abbreviated):
<s:Group...> <s:TextInput id="someId"/> </s:Group>
An instance of foo is provided to the MXML component via a code-behind page. I have tried binding foo.bar to someId.text in various ways, and it doesn't seem to work exactly. Meaning that if I change foo.bar then someId.text will change, but the reverse doesn't work.
I've tried binding with:
<fx:Binding source="foo.bar" destination="someId.text" twoWay="true"/>
no workie, and:
<s:TextInput id="someId" text="@{foo.bar}"/>
still no workie. Any ideas?
|
|
|
Bad form to reply to my own post, I know, but I also need to say that the compiler spits out a warning that "data binding will not be able to detect assignments to 'someId'.". What gives?
|
|