You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by piotrz <pi...@gmail.com> on 2017/01/02 07:42:23 UTC
[FlexJS, MDL] Why binding is not working in MDL example
Hi,
I've created item renderer to our menu example in MDL. I have model with VO.
I don't know why but binding seems to be not working. Am I doing something
wrong ?
During compilation I'm getting following warrnings [2]
[1] https://paste.apache.org/Xsbc
[2] https://paste.apache.org/tdxb
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
Jira created: https://issues.apache.org/jira/browse/FLEX-35236
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57834.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
That would be a bug, IMO.
-Alex
On 1/3/17, 4:13 AM, "piotrz" <pi...@gmail.com> wrote:
>I see what was the problem:
>
>If my VO has [Bindable] on the top of the class it is not working.
>
>[Bindable]
>public class MenuItemVO {}
>
>If I have [Bindable] on each properties it's working.
>
>public class MenuItemVO
> {
> [Bindable]
> public var label:String;
>}
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-bindin
>g-is-not-working-in-MDL-example-tp57738p57817.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
I see what was the problem:
If my VO has [Bindable] on the top of the class it is not working.
[Bindable]
public class MenuItemVO {}
If I have [Bindable] on each properties it's working.
public class MenuItemVO
{
[Bindable]
public var label:String;
}
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57817.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
Nope warning are gone. Previously I've missed Bindable property in VO object.
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57756.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
You cane check fresh results - Menu tab [1]. Item renderer with my code is
under: itemRenderers/CustomMenuItemRenderer.mxml
http://apacheflexbuild.cloudapp.net:8080/job/MDLExample/lastSuccessfulBuild/artifact/examples/flexjs/MDLExample/bin/js-debug/index.html
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57758.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
Alex,
That's what I'm missing. It's a bit better cause when I add bead
"ItemRendererDataBinding" my getter has been fired, although binding is
still not working. I've just pushed my code. - Not sure what can be wrong.
I have to admit I'm still thinking to much Flex instead of FlexJS :)
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57795.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
DataBinding expressions turn into data structures. A bead like
ContainerDataBinding has to be on the strand for the MXML file in order to
interpret the data structure and set up and execute the actual binding.
Maybe all you are missing is that. See ProductListItem.mxml in the
FlexJSStore example.
-Alex
On 1/2/17, 2:37 PM, "piotrz" <pi...@gmail.com> wrote:
>Alex,
>
>That's how it looks like:
>
>public class MenuItemRenderer extends MXMLItemRenderer
> public class MXMLItemRenderer extends DataItemRenderer implements
>ILayoutParent, ILayoutHost, IStrand
> public class DataItemRenderer extends UIItemRendererBase
> public class UIItemRendererBase extends UIBase implements
>ISelectableItemRenderer
>
>Are you saying that MenuItemRenderer should implement one of those classes
>"ContainerDataBinding " or "ItemRendererDataBinding " instead
>MXMLItemRenderer?
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-bindin
>g-is-not-working-in-MDL-example-tp57738p57787.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
Alex,
That's how it looks like:
public class MenuItemRenderer extends MXMLItemRenderer
public class MXMLItemRenderer extends DataItemRenderer implements
ILayoutParent, ILayoutHost, IStrand
public class DataItemRenderer extends UIItemRendererBase
public class UIItemRendererBase extends UIBase implements
ISelectableItemRenderer
Are you saying that MenuItemRenderer should implement one of those classes
"ContainerDataBinding " or "ItemRendererDataBinding " instead
MXMLItemRenderer?
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57787.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
What does MenuItemRenderer extend? I don't see the ContainerDataBinding
or ItemRendererDataBinding beads. Are they in a base class?
-Alex
On 1/2/17, 2:24 PM, "piotrz" <pi...@gmail.com> wrote:
>I have following code [1]. MenuItemRenderer is extending
>org.apache.flex.html.supportClasses.MXMLItemRenderer
>
>[1] https://paste.apache.org/y0DG
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-bindin
>g-is-not-working-in-MDL-example-tp57738p57784.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
I have following code [1]. MenuItemRenderer is extending
org.apache.flex.html.supportClasses.MXMLItemRenderer
[1] https://paste.apache.org/y0DG
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57784.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
How are you using it? Are you getting compiler errors? Did you put a
ContainerDataBinding or ItemRendererDataBinding in the MXML?
-Alex
On 1/2/17, 2:17 PM, "piotrz" <pi...@gmail.com> wrote:
>Alex,
>
>I did simple test:
>
>[Bindable("dataChange")]
>public function get menuItem():MenuItemVO
>{
> return data as MenuItemVO;
>}
>
>override public function set data(value:Object):void
>{
> super.data = value;
> dispatchEvent(new org.apache.flex.events.Event("dataChange"));
>}
>
>Above code do not working. It should work in FlexJS yes ?
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-bindin
>g-is-not-working-in-MDL-example-tp57738p57782.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
Alex,
I did simple test:
[Bindable("dataChange")]
public function get menuItem():MenuItemVO
{
return data as MenuItemVO;
}
override public function set data(value:Object):void
{
super.data = value;
dispatchEvent(new org.apache.flex.events.Event("dataChange"));
}
Above code do not working. It should work in FlexJS yes ?
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57782.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
Are you still getting the warning at compile time?
On 1/2/17, 7:39 AM, "piotrz" <pi...@gmail.com> wrote:
>I just tried "__NoChangeEvent__" and results is same. If it is like you
>said
>my renderer should pickup from each object property at creation required
>value. - It still not working for me.
>
>I will try to check whether it's working in FlexJSStore.
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-bindin
>g-is-not-working-in-MDL-example-tp57738p57752.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
I just tried "__NoChangeEvent__" and results is same. If it is like you said
my renderer should pickup from each object property at creation required
value. - It still not working for me.
I will try to check whether it's working in FlexJSStore.
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57752.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
On 1/2/17, 12:54 AM, "piotrz" <pi...@gmail.com> wrote:
>Alex,
>
>I have such property:
>
>[Bindable("dataChange")]
>public function get menuItem():MenuItemVO
>{
> return data as MenuItemVO;
>}
>
>My item renderer inherits from MXMLItemRenderer. I see that property
>"data"
>in my item renderer is being assigned and "data" from MXMLItemRenderer
>dispatch event "dataChange", so my getter for menuItem should be fired
>yes ?
A databinding expression of {data.someProperty} or {menuItem.someProperty}
is going to be checked for not only changes to what object data is
referencing, but also for when someProperty changes while the renderer is
just sitting there on the screen.
In most cases, checking for changes to someProperty is not needed in a
renderer. We don't have a great way of telling the compiler not to check
for changes to someProperty. I think FlexJSStore uses
[Bindable("__NoChangeEvent__")] to shut off all checks since renderers are
currently not recycled in our list classes. The binding will be evaluated
at renderer instantiation time and it will all "just work".
I suppose we could add some metadata for that scenario.
HTH,
-Alex
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by piotrz <pi...@gmail.com>.
Alex,
I have such property:
[Bindable("dataChange")]
public function get menuItem():MenuItemVO
{
return data as MenuItemVO;
}
My item renderer inherits from MXMLItemRenderer. I see that property "data"
in my item renderer is being assigned and "data" from MXMLItemRenderer
dispatch event "dataChange", so my getter for menuItem should be fired yes ?
Piotr
-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-binding-is-not-working-in-MDL-example-tp57738p57744.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS, MDL] Why binding is not working in MDL example
Posted by Alex Harui <ah...@adobe.com>.
If data and menuitem are Object then these are legitimate warnings. There
is no way to tell without introspection what the change events are. See
FlexJSStore's ProductListItem for one way to deal with it. It declares a
custom property of the type of the ValueObject. You can also cast the
data property to the ValueObject.
HTH,
-Alex
PS: Done for tonight...
On 1/1/17, 11:42 PM, "piotrz" <pi...@gmail.com> wrote:
>Hi,
>
>I've created item renderer to our menu example in MDL. I have model with
>VO.
>I don't know why but binding seems to be not working. Am I doing something
>wrong ?
>
>During compilation I'm getting following warrnings [2]
>
>[1] https://paste.apache.org/Xsbc
>[2] https://paste.apache.org/tdxb
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/FlexJS-MDL-Why-bindin
>g-is-not-working-in-MDL-example-tp57738.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.