You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mark goldin <ma...@gmail.com> on 2015/04/29 15:57:16 UTC

Binding is not working

I have a model class that is marked as [Bindable]. This model has an
ArrayCollection that becomes a dataProvider for a DataGrid after data has
arrived. I have a checkbox in a column that supposed to be checked when
data.makeCheckBoxeSeleted is true. I have a button that on click
sets data.makeCheckBoxeSeleted for all rows to true, but checkboxes in the
grid dont become selected. Any idea?

Thanks

Re: Binding is not working

Posted by Alex Harui <ah...@adobe.com>.

On 4/29/15, 8:52 AM, "mark goldin" <ma...@gmail.com> wrote:

>You are absolutely correct. It does generate a warning at runtime, but the
>problem with MyData(data).makeCheckBoxeSeleted is that
>makeCheckBoxeSeleted
>does not exist in a model class and it's added at runtime in order to
>drives checkboxes selections.

Hmm.  Not sure how you are adding a property at runtime.  Unless you use
Proxy, the only ways I can think of won’t generate change events and thus
won’t be bindable.  And even for Proxy, I’m not sure if the binding
subsystem would be able to determine the right change events.

-Alex

>
>On Wed, Apr 29, 2015 at 10:43 AM, Alex Harui <ah...@adobe.com> wrote:
>
>>
>>
>> On 4/29/15, 8:07 AM, "mark goldin" <ma...@gmail.com> wrote:
>>
>> >Well, I was missing ArrayCollection(dataProvider).refresh()
>>
>> That probably does work, but updates the entire item renderer, which may
>> result in performance issues.  If the CheckBox is only a small portion
>>of
>> the item renderer, there may be an optimization.
>>
>> If you actually used code like: selected=“{data.makeCheckBoxeSeleted}”,
>> that should have generated a warning at compile time because ‘data’ is
>> just an object and there is no way to compute the change events for the
>> makeCheckBoxeSelected property.  At runtime, it might have guessed at
>>the
>> wrong events.  Usually you have to coerce the type in the binding
>> expression as in:
>>
>> selected=“{MyData(data).makeCheckBoxeSeleted}”
>>
>>
>> HTH,
>> -Alex
>>
>>
>> >
>> >On Wed, Apr 29, 2015 at 9:03 AM, kevin.godell <ke...@gmail.com>
>> >wrote:
>> >
>> >> I would debug your array collection by listening to the collection
>> >>change
>> >> event and see if your bindable objects are dispatching propertychange
>> >> events. If not, I think you may have to use getter and setter
>>functions
>> >> when setting the property to get propertychange event to trigger.
>> >>
>> >> On Wednesday, April 29, 2015, mark goldin [via Apache Flex Users] <
>> >> ml-node+s2333346n10217h27@n4.nabble.com> wrote:
>> >>
>> >> > I have a model class that is marked as [Bindable]. This model has
>>an
>> >> > ArrayCollection that becomes a dataProvider for a DataGrid after
>>data
>> >>has
>> >> > arrived. I have a checkbox in a column that supposed to be checked
>> >>when
>> >> > data.makeCheckBoxeSeleted is true. I have a button that on click
>> >> > sets data.makeCheckBoxeSeleted for all rows to true, but
>>checkboxes in
>> >> the
>> >> > grid dont become selected. Any idea?
>> >> >
>> >> > Thanks
>> >> >
>> >> >
>> >> > ------------------------------
>> >> >  If you reply to this email, your message will be added to the
>> >>discussion
>> >> > below:
>> >> >
>> >> >
>> >>
>> >>
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp1
>> >>0217.html
>> >> >  To start a new topic under Apache Flex Users, email
>> >> > ml-node+s2333346n1h31@n4.nabble.com
>> >> >
>> 
>>>><javascript:_e(%7B%7D,'cvml','ml-node%2Bs2333346n1h31@n4.nabble.com');>
>> >> > To unsubscribe from Apache Flex Users, click here
>> >> > <
>> >>
>> >>
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?m
>> 
>>>>acro=unsubscribe_by_code&node=1&code=a2V2aW4uZ29kZWxsQGdtYWlsLmNvbXwxfD
>>>>I1
>> >>MDE5NDgwNQ==
>> >> >
>> >> > .
>> >> > NAML
>> >> > <
>> >>
>> >>
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?m
>> 
>>>>acro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.nam
>>>>l.
>> 
>>>>namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabb
>>>>le
>> 
>>>>.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabbl
>>>>e%
>> 
>>>>3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21
>>>>na
>> >>bble%3Aemail.naml
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >>
>> >> -----
>> >> .
>> >> --
>> >> View this message in context:
>> >>
>> >>
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp1
>> >>0217p10218.html
>> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>> >>
>>
>>


Re: Binding is not working

Posted by mark goldin <ma...@gmail.com>.
You are absolutely correct. It does generate a warning at runtime, but the
problem with MyData(data).makeCheckBoxeSeleted is that makeCheckBoxeSeleted
does not exist in a model class and it's added at runtime in order to
drives checkboxes selections.

On Wed, Apr 29, 2015 at 10:43 AM, Alex Harui <ah...@adobe.com> wrote:

>
>
> On 4/29/15, 8:07 AM, "mark goldin" <ma...@gmail.com> wrote:
>
> >Well, I was missing ArrayCollection(dataProvider).refresh()
>
> That probably does work, but updates the entire item renderer, which may
> result in performance issues.  If the CheckBox is only a small portion of
> the item renderer, there may be an optimization.
>
> If you actually used code like: selected=“{data.makeCheckBoxeSeleted}”,
> that should have generated a warning at compile time because ‘data’ is
> just an object and there is no way to compute the change events for the
> makeCheckBoxeSelected property.  At runtime, it might have guessed at the
> wrong events.  Usually you have to coerce the type in the binding
> expression as in:
>
> selected=“{MyData(data).makeCheckBoxeSeleted}”
>
>
> HTH,
> -Alex
>
>
> >
> >On Wed, Apr 29, 2015 at 9:03 AM, kevin.godell <ke...@gmail.com>
> >wrote:
> >
> >> I would debug your array collection by listening to the collection
> >>change
> >> event and see if your bindable objects are dispatching propertychange
> >> events. If not, I think you may have to use getter and setter functions
> >> when setting the property to get propertychange event to trigger.
> >>
> >> On Wednesday, April 29, 2015, mark goldin [via Apache Flex Users] <
> >> ml-node+s2333346n10217h27@n4.nabble.com> wrote:
> >>
> >> > I have a model class that is marked as [Bindable]. This model has an
> >> > ArrayCollection that becomes a dataProvider for a DataGrid after data
> >>has
> >> > arrived. I have a checkbox in a column that supposed to be checked
> >>when
> >> > data.makeCheckBoxeSeleted is true. I have a button that on click
> >> > sets data.makeCheckBoxeSeleted for all rows to true, but checkboxes in
> >> the
> >> > grid dont become selected. Any idea?
> >> >
> >> > Thanks
> >> >
> >> >
> >> > ------------------------------
> >> >  If you reply to this email, your message will be added to the
> >>discussion
> >> > below:
> >> >
> >> >
> >>
> >>
> http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp1
> >>0217.html
> >> >  To start a new topic under Apache Flex Users, email
> >> > ml-node+s2333346n1h31@n4.nabble.com
> >> >
> >><javascript:_e(%7B%7D,'cvml','ml-node%2Bs2333346n1h31@n4.nabble.com');>
> >> > To unsubscribe from Apache Flex Users, click here
> >> > <
> >>
> >>
> http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?m
> >>acro=unsubscribe_by_code&node=1&code=a2V2aW4uZ29kZWxsQGdtYWlsLmNvbXwxfDI1
> >>MDE5NDgwNQ==
> >> >
> >> > .
> >> > NAML
> >> > <
> >>
> >>
> http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?m
> >>acro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.
> >>namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble
> >>.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%
> >>3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21na
> >>bble%3Aemail.naml
> >> >
> >> >
> >>
> >>
> >>
> >>
> >> -----
> >> .
> >> --
> >> View this message in context:
> >>
> >>
> http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp1
> >>0217p10218.html
> >> Sent from the Apache Flex Users mailing list archive at Nabble.com.
> >>
>
>

Re: Binding is not working

Posted by Alex Harui <ah...@adobe.com>.

On 4/29/15, 8:07 AM, "mark goldin" <ma...@gmail.com> wrote:

>Well, I was missing ArrayCollection(dataProvider).refresh()

That probably does work, but updates the entire item renderer, which may
result in performance issues.  If the CheckBox is only a small portion of
the item renderer, there may be an optimization.

If you actually used code like: selected=“{data.makeCheckBoxeSeleted}”,
that should have generated a warning at compile time because ‘data’ is
just an object and there is no way to compute the change events for the
makeCheckBoxeSelected property.  At runtime, it might have guessed at the
wrong events.  Usually you have to coerce the type in the binding
expression as in:

selected=“{MyData(data).makeCheckBoxeSeleted}”


HTH,
-Alex
 

>
>On Wed, Apr 29, 2015 at 9:03 AM, kevin.godell <ke...@gmail.com>
>wrote:
>
>> I would debug your array collection by listening to the collection
>>change
>> event and see if your bindable objects are dispatching propertychange
>> events. If not, I think you may have to use getter and setter functions
>> when setting the property to get propertychange event to trigger.
>>
>> On Wednesday, April 29, 2015, mark goldin [via Apache Flex Users] <
>> ml-node+s2333346n10217h27@n4.nabble.com> wrote:
>>
>> > I have a model class that is marked as [Bindable]. This model has an
>> > ArrayCollection that becomes a dataProvider for a DataGrid after data
>>has
>> > arrived. I have a checkbox in a column that supposed to be checked
>>when
>> > data.makeCheckBoxeSeleted is true. I have a button that on click
>> > sets data.makeCheckBoxeSeleted for all rows to true, but checkboxes in
>> the
>> > grid dont become selected. Any idea?
>> >
>> > Thanks
>> >
>> >
>> > ------------------------------
>> >  If you reply to this email, your message will be added to the
>>discussion
>> > below:
>> >
>> >
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp1
>>0217.html
>> >  To start a new topic under Apache Flex Users, email
>> > ml-node+s2333346n1h31@n4.nabble.com
>> > 
>><javascript:_e(%7B%7D,'cvml','ml-node%2Bs2333346n1h31@n4.nabble.com');>
>> > To unsubscribe from Apache Flex Users, click here
>> > <
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?m
>>acro=unsubscribe_by_code&node=1&code=a2V2aW4uZ29kZWxsQGdtYWlsLmNvbXwxfDI1
>>MDE5NDgwNQ==
>> >
>> > .
>> > NAML
>> > <
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?m
>>acro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.
>>namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble
>>.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%
>>3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21na
>>bble%3Aemail.naml
>> >
>> >
>>
>>
>>
>>
>> -----
>> .
>> --
>> View this message in context:
>> 
>>http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp1
>>0217p10218.html
>> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>>


Re: Binding is not working

Posted by mark goldin <ma...@gmail.com>.
Well, I was missing ArrayCollection(dataProvider).refresh()

On Wed, Apr 29, 2015 at 9:03 AM, kevin.godell <ke...@gmail.com>
wrote:

> I would debug your array collection by listening to the collection change
> event and see if your bindable objects are dispatching propertychange
> events. If not, I think you may have to use getter and setter functions
> when setting the property to get propertychange event to trigger.
>
> On Wednesday, April 29, 2015, mark goldin [via Apache Flex Users] <
> ml-node+s2333346n10217h27@n4.nabble.com> wrote:
>
> > I have a model class that is marked as [Bindable]. This model has an
> > ArrayCollection that becomes a dataProvider for a DataGrid after data has
> > arrived. I have a checkbox in a column that supposed to be checked when
> > data.makeCheckBoxeSeleted is true. I have a button that on click
> > sets data.makeCheckBoxeSeleted for all rows to true, but checkboxes in
> the
> > grid dont become selected. Any idea?
> >
> > Thanks
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp10217.html
> >  To start a new topic under Apache Flex Users, email
> > ml-node+s2333346n1h31@n4.nabble.com
> > <javascript:_e(%7B%7D,'cvml','ml-node%2Bs2333346n1h31@n4.nabble.com');>
> > To unsubscribe from Apache Flex Users, click here
> > <
> http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=a2V2aW4uZ29kZWxsQGdtYWlsLmNvbXwxfDI1MDE5NDgwNQ==
> >
> > .
> > NAML
> > <
> http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> -----
> .
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp10217p10218.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: Binding is not working

Posted by "kevin.godell" <ke...@gmail.com>.
I would debug your array collection by listening to the collection change
event and see if your bindable objects are dispatching propertychange
events. If not, I think you may have to use getter and setter functions
when setting the property to get propertychange event to trigger.

On Wednesday, April 29, 2015, mark goldin [via Apache Flex Users] <
ml-node+s2333346n10217h27@n4.nabble.com> wrote:

> I have a model class that is marked as [Bindable]. This model has an
> ArrayCollection that becomes a dataProvider for a DataGrid after data has
> arrived. I have a checkbox in a column that supposed to be checked when
> data.makeCheckBoxeSeleted is true. I have a button that on click
> sets data.makeCheckBoxeSeleted for all rows to true, but checkboxes in the
> grid dont become selected. Any idea?
>
> Thanks
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp10217.html
>  To start a new topic under Apache Flex Users, email
> ml-node+s2333346n1h31@n4.nabble.com
> <javascript:_e(%7B%7D,'cvml','ml-node%2Bs2333346n1h31@n4.nabble.com');>
> To unsubscribe from Apache Flex Users, click here
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=a2V2aW4uZ29kZWxsQGdtYWlsLmNvbXwxfDI1MDE5NDgwNQ==>
> .
> NAML
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




-----
.
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Binding-is-not-working-tp10217p10218.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.