[FIXED] [#801] [3.2.0] setDisabled(false) not working for RadioGroup

  1. #1

    [FIXED] [#801] [3.2.0] setDisabled(false) not working for RadioGroup

    I have a table

    <table>
                        <tr>
                            <td>Do you have any disability ?</td>
                            <td>   
                                @(X.RadioGroupFor(m => m.IsHandicap, new List<Radio.Config> { 
                                    new Radio.Config { BoxLabel = "Yes", InputValue = "1" },
                                    new Radio.Config { BoxLabel = "No", InputValue = "0", Checked = true}
                                    }).ID("IsHandicap").Width(400).Listeners(ls => ls.Change.Fn = "onHandicapChange").FireChangeOnLoad(true)
                                )                         
                            </td>
                        </tr>
                        <tr>
                            <td>(If yes, state the type of disability..)</td>
                            <td>@(X.RadioGroupFor(m => m.HandicapType, new List<Radio.Config> { 
                                    new Radio.Config { BoxLabel = "Chronic Illness", InputValue = "Chronic Illness"},
                                    new Radio.Config { BoxLabel = "Physical Disability", InputValue = "Physical Disability" },
                                    new Radio.Config { BoxLabel = "Impairment", InputValue = "Impairment" },
                                    new Radio.Config { BoxLabel = "Others", InputValue = "Others" }
                            }).ID("HandicapType").Width(150).ColumnsNumber(1).Disabled(true))
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">@X.TextAreaFor(m => m.HandicapNature).ID("HandicapNature").Name("HandicapNature").LabelWidth(100).Width(500).Disabled(true).ReadOnly(Model.ReadOnly).Vtype("alpha")</td>
                        </tr>
                    </table>

    My onHandicapChange implementation ia as follows -


            
    
    var onHandicapChange = function () {
                if (Ext.getCmp("IsHandicap").getValue().IsHandicap == 1) {
                    Ext.getCmp("HandicapType").setDisabled(false);
                    Ext.getCmp("HandicapNature").setDisabled(false);
                } else {
                    Ext.getCmp("HandicapType").setDisabled(true);
                    Ext.getCmp("HandicapNature").setDisabled(true);
                    //Ext.getCmp("HandicapNature").setValue('');
                }
            }
    The problem I am facing is - Ext.getCmp("HandicapType").setDisabled(false); is not enabling the Radio Buttons. Ext.getCmp("HandicapNature").setDisabled(false) works though.
    Last edited by Daniil; Jun 23, 2015 at 11:28 AM. Reason: [FIXED] [#801] [3.2.0]
  2. #2
    Hello,

    Confirmed, the setDisabled method does not work in a consistent way. Also, the FireChangeOnLoad does not work.

    We are opening related issues but you can use the following workaround for the time being (it is interesting to note the use of the oldValue, newValue parameters of the Change handler):

    @model Mvc3.Models.GroupForModel
    
    @{
        Layout = null;
        var X = Html.X();
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title></title>
        <script>
            var onHandicapChange = function (oldValue, newValue) {
                Ext.getCmp("HandicapType").items.each(function (c) {
                    c.setDisabled(newValue.IsHandicap !== "1");
                });
            };
        </script>
    </head>
    <body>
        @(X.ResourceManager())
        <table>
            <tr>
                <td>Do you have any disability ?</td>
                <td>   
                    @(X.RadioGroupFor(m => m.IsHandicap, new List<Radio.Config> { 
                        new Radio.Config { BoxLabel = "Yes", InputValue = "1", Checked = true },
                        new Radio.Config { BoxLabel = "No", InputValue = "0" }
                        }).ID("IsHandicap").Width(400).Listeners(ls => ls.Change.Fn = "onHandicapChange").FireChangeOnLoad(true)
                    )           
                </td>
            </tr>
            <tr>
                <td>(If yes, state the type of disability..)</td>
                <td>@(X.RadioGroupFor(m => m.HandicapType, new List<Radio.Config> { 
                        new Radio.Config { BoxLabel = "Chronic Illness", InputValue = "Chronic Illness", Disabled = Model.IsHandicap == "0" },
                        new Radio.Config { BoxLabel = "Physical Disability", InputValue = "Physical Disability", Disabled = Model.IsHandicap == "0" },
                        new Radio.Config { BoxLabel = "Impairment", InputValue = "Impairment", Disabled = Model.IsHandicap == "0" },
                        new Radio.Config { BoxLabel = "Others", InputValue = "Others", Disabled = Model.IsHandicap == "0" }
                }).ID("HandicapType").Width(150).ColumnsNumber(1))
                </td>
            </tr>
        </table>
    </body>
    </html>
  3. #3
  4. #4
    Thanks for the work around.

    One issue still there in the work around is - the text of Radio are faded after setting setDisabled(false).
  5. #5
    Quote Originally Posted by barnali

    Thanks for the work around.

    One issue still there in the work around is - the text of Radio are faded after setting setDisabled(false).
    Can you please open a new issue for this on the 3.x premium forum?

    Thank you.
  6. #6
    .setDisabled() started to work with ExtJS 5.1.1 and Ext.NET 3.2.0. It is already in SVN trunk and 3.2.0 will be released soon.

    FireChangeOnLoad is still an issue, though.
  7. #7
    Daniil,

    is there a way for me to get the 3.2 before it released ?
  8. #8
    Yes, it is in SVN trunk.
    http://svn.ext.net/premium/trunk

    This FAQ item might also help.
    How can I access the Svn source code repository?

Similar Threads

  1. e.Success = False not working.
    By Lisseth in forum 1.x Help
    Replies: 2
    Last Post: May 18, 2015, 4:50 PM
  2. [OPEN] [#425] radiogroup allowblank not working
    By SoftwareMHC in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 05, 2014, 8:21 PM
  3. [CLOSED] Listview Sortable=false not working
    By jchau in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 21, 2011, 5:56 PM
  4. Replies: 1
    Last Post: Jun 07, 2010, 7:19 AM
  5. Replies: 0
    Last Post: Dec 08, 2009, 1:57 AM

Posting Permissions