Results 1 to 3 of 3

Thread: 'value' config does not work for Ext.form.field.Checkbox

    You found a bug! We've classified it as EXTJS-9969 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Default 'value' config does not work for Ext.form.field.Checkbox

    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.2.0
    Browser versions tested against:
    • ALL Browsers
    Description:
    • 'value' config does not work
    Steps to reproduce the problem:
    • Create an Ext.form.field.Checkbox and try to set 'value' config
    The result that was expected:
    • field should be initialized by 'value' config
    The result that occurs instead:

    • field is not initialized by 'value' config
    Test Case:
    Code:
        Ext.onReady(function() {
                Ext.QuickTips.init();
                Ext.create('Ext.form.Panel', {
                    bodyPadding: 10,
                    width: 300,
                    title: 'Pizza Order',
                    items: [
                        {
                            xtype: 'fieldcontainer',
                            fieldLabel: 'Toppings',
                            defaultType: 'checkboxfield',
                            items: [
                                {
                                    boxLabel  : 'Anchovies',
                                    name      : 'topping',
                                    inputValue: '1',
                                    id        : 'checkbox1',
                                    //checked   : true, //works                                
                                    value      : true //not works
                                }
                            ]
                        }
                    ],
                    renderTo: Ext.getBody()
                });
            });


    http://jsfiddle.net/rchernyshenko/Wwrry/

    According to http:// http://docs.sencha.com/extjs...kbox-cfg-value 'A value to initialize this field with.'. Config does not work because checkbox has own implementation http://docs.sencha.com/extjs/4.2.1/source/Checkbox.html#Ext-form-field-Checkbox-method-initValue
    which uses 'checked' config instead 'value' config. By default all other fields use http://docs.sencha.com/extjs/4.2.1/s...thod-initValue and 'value' config works as expected.

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

    This falls in the documentation bug category as checkbox and radiofield will use checked: true to initialize the field as checked/selected.

  3. #3

    Default

    But it will be inconsistent behavior with other fields. I my project I have many configured fields then in runtime I read this configuration and create Ext fields. I do not want put additional logic to determinate if this checkbox or textfield for example. Could you please consider override initValue method just change 1 line from

    checked = !!me.checked;to

    checked = !!me.checked || !!me.value

Posting Permissions

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