You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Devsena (JIRA)" <ji...@apache.org> on 2017/01/10 07:26:58 UTC

[jira] [Comment Edited] (FLEX-35227) [FlexJS] Data Binding Fails When Following Multiple References

    [ https://issues.apache.org/jira/browse/FLEX-35227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15814177#comment-15814177 ] 

Devsena edited comment on FLEX-35227 at 1/10/17 7:26 AM:
---------------------------------------------------------

Actually the above scenario was always working in my tests also, previously, when you binding a field to an UI component in single reference way, i.e.,
<js:TextInput text="*\{anyClass.fieldName\}*"/>

But, this never works if you the field name comes after multiple references, i.e.,
<js:TextInput text="*\{anyClass.anotherClass.fieldName\}*"/>

[~sko], your tests shown the binding in a single-referenced way, but it fails in multi-referenced way.


was (Author: santanu4ver):
Actually the above scenario was always working in my tests also, previously, when you binding a field to an UI component in single reference way, i.e.,
<js:TextInput text="*{anyClass.fieldName}*"/>

But, this never works if you the field name comes after multiple references, i.e.,
<js:TextInput text="*{anyClass.anotherClass.fieldName}*"/>

[~sko], your tests shown the binding in a single-referenced way, but it fails in multi-referenced way.

> [FlexJS] Data Binding Fails When Following Multiple References
> --------------------------------------------------------------
>
>                 Key: FLEX-35227
>                 URL: https://issues.apache.org/jira/browse/FLEX-35227
>             Project: Apache Flex
>          Issue Type: Bug
>    Affects Versions: Apache FlexJS 0.8.0
>            Reporter: Devsena
>            Assignee: Piotr Zarzycki
>         Attachments: POCSource.zip, POCSource_simple.zip
>
>
> Bracketed data binding to UI component do not works properly in FlexJS 0.8.0 nightly build SDK (my tests were mainly concentrated to HTML output in browsers). 
> *Works*
> {code}
> <js:Label id="lbl" text="{anyClass.fieldA}" width="300"/>
> {code}
> *Do not works*
> {code}
> <js:Label text="{anyClass.subClass.fieldB}" width="300"/>
> {code}
> Binding to UI component seems do not works when there are multiple reference, i.e. _class.field.field_. Following are the snippets of the codes which I used in this test:
> *InitialView MXML file*
> {code}
> [Bindable] private var anyClass:ClassA = new ClassA();
> protected function onTextInputChangeA(event:Event):void
> {
> 	anyClass.fieldA = myTI1.text;
> }
> 			
> protected function onTextInputChangeB(event:Event):void
> {
> 	anyClass.subClass.fieldB = myTI2.text;
> }
> ...
> <js:VContainer width="500">
> 	...
> 	<js:TextInput id="myTI1" text="Change Value.." change="onTextInputChangeA(event)"/>
> 	<js:Label id="lbl" text="{anyClass.fieldA}" width="300"/>
> </js:VContainer>
> <js:VContainer width="500">
> 	...
> 	<js:TextInput id="myTI2" text="Change Value.." change="onTextInputChangeB(event)"/>
> 	<js:Label text="{anyClass.subClass.fieldB}" width="300"/>
> </js:VContainer>
> {code}
> *ClassA*
> {code}
> public class ClassA extends EventDispatcher
> {
> 	[Bindable] public var subClass:ClassB = new ClassB();
> 		
> 	public function ClassA() { }
> 	
> 	private var _fieldA:String = "";
> 	[Bindable("fieldAChanged")]
> 	public function get fieldA():String
> 	{
> 		return _fieldA;
> 	}
> 		
> 	public function set fieldA(value:String):void
> 	{
> 		if (value != _fieldA)
> 		{
> 			_fieldA = value;
> 			dispatchEvent(new Event("fieldAChanged"));
> 		}
> 	}
> }
> {code}
> *ClassB*
> {code}
> [Bindable] public class ClassB extends EventDispatcher
> {
> 	public function ClassB()
> 	{ }
> 		
> 	private var _fieldB:String;
> 		
> 	[Bindable(event="fieldBChanged")]
> 	public function get fieldB():String
> 	{
> 		return _fieldB;
> 	}
> 		
> 	public function set fieldB(value:String):void
> 	{
> 		if (value != _fieldB)
> 		{
> 			_fieldB= value;
> 			dispatchEvent(new Event("fieldBChanged"));
> 		}
> 	}
> }
> {code}
> I've attached herewith the source to the test project. Please, take a look.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)