Results 1 to 6 of 6

Thread: getModelData() of Checkbox form field no more working correctly with 6.0.2

    This duplicates another forum thread, you can visit that thread here.
  1. #1
    Sencha Premium User
    Join Date
    Nov 2013
    Location
    Piacenza, Italy
    Posts
    220

    Default getModelData() of Checkbox form field no more working correctly with 6.0.2

    With Ext JS 6.0.2 the method getModelData() of Ext.form.field.Checkbox has been overriden so that it returns the result of getSubmitValue() (a String) instead of Model data (a Boolean).

    With 6.0.1:
    • getModelData() : `true`/`false`
    • getSubmitValue(): "on"/`null`
    With 6.0.2:
    • getModelData() : "on"/`null`
    • getSubmitValue(): "on"/`null`
    In this way the two methods return the same value and you cannot have Model data anymore!


    Override to fix it:
    Code:
    Ext.define('MyPatch.form.field.Checkbox', {
        override: 'Ext.form.field.Checkbox'
    }, function (thisClass) {
        delete thisClass.prototype.getModelData;
    });

  2. #2
    Sencha Premium User
    Join Date
    Nov 2013
    Location
    Piacenza, Italy
    Posts
    220

    Default

    May be this other issue is related to the same changes that caused this issue:
    https://www.sencha.com/forum/showthread.php?311786-Ext.form.Basic-gt-getValues-can-break-for-checkboxes&p=1138604

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Can you please post a test case which reproduces this issue?
    https://fiddle.sencha.com/#home

  4. #4
    Sencha Premium User
    Join Date
    Nov 2013
    Location
    Piacenza, Italy
    Posts
    220

    Default

    The override in "Ext.form.field.Checkbox.getModelData()" calls "this.getSubmitValue()" removing the differences between the two methods, which instead MUST give different results!

    Moreover note that there is bug also in the documentation as it does not tell you that the method is overridden!
    http://docs.sencha.com/extjs/6.0.2-c...d-getModelData

    Check this Fiddle with 6.0.1 (works correctly) and 6.0.2 (bug).


  5. #5
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256
    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.

  6. #6
    Sencha Premium User
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    122

    Default

    Same with ExtJS 5.1.3.

    Why was this changed? In my opinion it was completely right to return boolean values for the value and 'on' in form submit. The documentation points out, that inputValue and uncheckedValue are used for submit only.

    @agarberi: Thanks for the override. We'll probably use it like this.

    EDIT:
    Found the original 'bug' report where the old behavior was being called 'wrong', which is probably the reason why it was 'fixed' in Ext-15307: https://www.sencha.com/forum/showthr...of-inputValues

Similar Threads

  1. Replies: 2
    Last Post: 9 Jun 2014, 6:37 AM
  2. Replies: 4
    Last Post: 22 Jan 2013, 6:40 AM
  3. [OPEN] [1.1.0] Ext.form.Checkbox isDirty does not work correctly
    By Trixor in forum Sencha Touch 1.x: Bugs
    Replies: 0
    Last Post: 29 Mar 2011, 11:17 AM
  4. Replies: 2
    Last Post: 21 Jun 2008, 10:21 AM

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
  •