Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Data binding with model validation problem

  1. #1
    Sencha Premium Member volkans80's Avatar
    Join Date
    Mar 2012
    Location
    Ankara, Turkey
    Posts
    90
    Answers
    2

    Default Data binding with model validation problem

    I have a grid and binded form with model validation. When i delete a form field value with presence validation, grid column value not change. Am I missing something or is this a bug?

    ExtJS 5.0.1.1255 and 5.1.0.107 not working.
    ExtJS 5.0.0.970 working normally but i think there is not model validation in this version.


    1.Select row.
    2.Select all text in form field.
    3.Delete text.

    You can test it with this fiddle.

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    It seems that model refuses to set its field to an invalid value. I cannot say if it is an intended behavior or a bug. It could be configurable, if intended.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  3. #3
    Sencha Premium Member volkans80's Avatar
    Join Date
    Mar 2012
    Location
    Ankara, Turkey
    Posts
    90
    Answers
    2

    Default

    How can i implement grid-form binding with model validation and also users can be able to view validation errors?

    I want to use model.isValid() method but in my scenario this is not possible because model not accepting invalid values and isValid() method always returns true.

  4. #4
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    I don't think it is even possible. This 5.0.0 example works how you want, right. However, 5.0.1 + does not let you to set data field to an invalid value. I haven't found any config that could change this behavior.

    Ext Editor has revertInvalid config option but that is not the case here. Data field/validators do not have a way to change the default behavior.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  5. #5
    Sencha Premium Member volkans80's Avatar
    Join Date
    Mar 2012
    Location
    Ankara, Turkey
    Posts
    90
    Answers
    2

    Default

    I removed validations in model and modelValidation:true from form and used allowBlank: false in form fields but nothing changed. There is not a model validation but still model is not accepting empty value from form.

  6. #6
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    And what happens if you remove the validation completely? Can you then set empty value?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  7. #7
    Sencha Premium Member volkans80's Avatar
    Join Date
    Mar 2012
    Location
    Ankara, Turkey
    Posts
    90
    Answers
    2

    Default

    Yes if we remove model validations and allowBlank config then it allow empty value. Also if there is model validation in model definition and remove modelValidation:true config then it allow empty value.Every scenario is not allowing me to view validation errors on form and temporary set empty value at the same time.Suppose the validation is set to length of string 5. Then store always keeps first 5 char of string until user is set a new string longer than 4 char.

  8. #8
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    It is unexpected and unusual behavior. File it as a bug please.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  9. #9

    Default

    This behavior is by design; check "Model & Field Validation" in http://www.sencha.com/blog/whats-new-in-ext-js-5-0-1.

    It should have been made configurable in my opinion; for example, what if we want to bind the "disabled" property of a "Reset" button in a form to the dirty status of the model? Any invalid change wouldn't then affect the button.

  10. #10
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Answers
    512

    Default

    Well, it's a "design bug", perhaps.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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