lundi 1 décembre 2014

Binding notify problem with array binding



  1. Thank you for reporting this bug. We will make it our priority to review this report.







  2. Default Binding notify problem with array binding



    Binding notify problem with array binding





    Hi,

    I'm currently trying to use "bindTo" with "deep:true" on an object, which one of its property is an array.

    This will be more clear here:

    http://ift.tt/1zaAwQp


    Each click on a button must increments the label by 1. For the first button, which is bind to a number property on my objet, all works well.

    The second button is bind to an array which is a sub-property of my object. On click, the label is not updated, but the model inside is. If you click on the first button (and then implies a refresh), the second button label will be updated to the correct value.


    Am I doing something wrong or is there a real problem?

    Thank you!














  3. Default







    I find a workaround:

    http://ift.tt/1vCTlN4

    It seems that re-setting the same array (even with new or different elements) breaks the binding detection. The array have to be a new reference.

    Thus, changing this:



    Code:



    obj.bar[0] = obj.bar[0]+1;

    to this:


    Code:



    obj.bar[0] = obj.bar.slice()[0]+1;

    makes it work....

    I might be wrong, but I'm not sure it's the desired behaviour.















  4. Evan Trimboli

    Sencha Developer

    Twitter - @evantrimboli

    Don't be afraid of the source code!













Binding notify problem with array binding

Aucun commentaire:

Enregistrer un commentaire