1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    2
    Vote Rating
    0
    ulrich.b is on a distinguished road

      0  

    Default Unanswered: Override Model.isEqual()

    Unanswered: Override Model.isEqual()


    My model class contains an array field. My problem is that, the standard Model-class doesn't recognize a set()-call with the same value, because the isEqual()-Method just uses the === operator.

    Is it a good idea to overwrite the isEqual()-method? In the documentation it's marked with @private. What exactly does this annotation mean?

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,118
    Vote Rating
    30
    Answers
    85
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    I think your can override it for that specific model. But === does type comparison, isn't is possible to cast the input in the correct type?

    Private means very often: 'not in the docs'. So you are not sure the function is still there with the next release. But this one I think you can override, no problem.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    2
    Vote Rating
    0
    ulrich.b is on a distinguished road

      0  

    Default


    Many thanks for your answer.

    Quote Originally Posted by tvanzoelen View Post
    But === does type comparison, isn't is possible to cast the input in the correct type?
    Thats not possible, because the JavaScript === operator works just for scalar values, and I have an array (i.e. the expression [] === [] or {}==={} both return false).

Thread Participants: 1

Tags for this Thread