Results 1 to 5 of 5

Thread: Multi bind oldValue always the same as the value

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257

    Default Multi bind oldValue always the same as the value

    Affects all versions.

    Test case:

    https://fiddle.sencha.com/#view/editor&fiddle/2klh

    By running the test case, you can see that when the initial bind fires, the oldValue is the same as the initial value. It should be undefined in this case.

    When the second bind fires, the oldValue should be:

    Code:
    {
        foo: 1,
        bar: 2
    }
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  2. #2
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    567

    Default

    Hello Evan,

    Thank you for the post.

    As per the docs the callback is supposed to have only current value.


    https://docs.sencha.com/extjs/6.6.0/...ml#method-bind

    Regards,
    Kumar
    Sencha Support.

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257

    Default

    The docs are incorrect.

    As you can see it my test case, it passes 2 values to the callback. Why would it pass the same value twice to the callback?

    Also, you can clearly see it passes the old value for a simple binding:

    https://fiddle.sencha.com/#view/editor&fiddle/2luv

    Also, if you would take a minute to look at the code, you will clearly see that it intends to pass the previous value.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  4. #4
    Sencha Premium User
    Join Date
    Feb 2012
    Posts
    18

    Default

    I agree with Evan. This does appear to be an issue since it makes little sense to send the same value twice. The code in Ext.app.bind.BaseBinding->notify is clearly attempting to send me.lastValue as the 2nd parameter:

    Code:
    previous = me.lastValue;
    
    //removed for brevity
    
    me.callback.call(me.scope, value, previous, me);
    Evan, if you wanted to override this, please take a look at this fiddle:
    https://fiddle.sencha.com/#view/editor&fiddle/2m1o

    Thanks

  5. #5
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257

    Default

    Thanks for your post, I have a similar fix applied locally.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Similar Threads

  1. How to access multi selection via bind?
    By stephanschuster in forum Ext 5: Q&A
    Replies: 4
    Last Post: 13 Jan 2017, 8:02 AM
  2. multi-bind XTemplate in widgetcolumn
    By clampart in forum Ext JS 6.x Q&A
    Replies: 0
    Last Post: 28 Nov 2016, 9:54 AM
  3. [INFOREQ] datepicker setValue(null) issue when oldValue is Date
    By fappels in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 24 Aug 2015, 6:12 AM
  4. combobox: change event has empty oldValue
    By digitalturbulence in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 27 Oct 2009, 8:18 AM
  5. datefield change event oldvalue
    By bebonham in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 13 Aug 2007, 9:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •