[OPEN] [#1635] [4.8.1] Checking Checkbox via JS

  1. #1

    [OPEN] [#1635] [4.8.1] Checking Checkbox via JS

    Support,

    I am having trouble a something very simple. I want to check the BBBB box every time i show the Window. I used the setValue function and i cannot get it to work at all. per docs (https://docs.sencha.com/extjs/6.7.0/...ethod-setValue), there are 4 allowed values i can set and none work!

    see example and pls assist.

    thanks
    /Z

    <%@ Page Language="C#" %>
    
    
    <!DOCTYPE html>
    
    
    <html>
    <head id="Head2" runat="server">
        <title>Test</title>
    </head>
    
    
    <body>
    
    
        <ext:ResourceManager ID="ResourceManager2" runat="server" Theme="NeptuneTouch" />
    
    
            <ext:Viewport ID="Viewport1" runat="server" Layout="VBoxLayout">          
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" />
                </LayoutConfig>
                <Items>
    
    
                    <ext:Button runat="server" Text="PRESS ME"> 
                        <Listeners>
                            <Click Handler="App.bbbb.setValue('1');App.winme.show()" />
                        </Listeners>
                    </ext:Button>
    
    
                </Items>
            </ext:Viewport>
    
    
    
    
        <ext:Window 
            runat="server" 
            ID="winme"
            Icon="ApplicationFormAdd" 
            Width="400" 
            AutoHeight="true" 
            Hidden="true" 
            Modal="true"
            Constrain="true">
            <Items>
                <ext:FieldSet runat="server"
                    Layout="HBoxLayout"
                    PaddingSpec="0 0 0 30"
                    WidthSpec="100%"
                    >
                    <LayoutConfig>
                        <ext:HBoxLayoutConfig Align="Stretch" Pack="Center" />
                    </LayoutConfig>
                    <Items>
                        <ext:Checkbox ID="aaaa" BoxLabel="AAAA" runat="server" Note="SOME AAAA" Flex="1" />
                        <ext:Checkbox ID="bbbb" BoxLabel="BBBB" runat="server" Note="SOME BBBB" Flex="1" />
                        <ext:Checkbox ID="cccc" BoxLabel="CCCC" runat="server" Note="SOME CCCC" Flex="1" />
                    </Items>
                </ext:FieldSet>
            </Items> 
        </ext:Window>
    </body>
    </html>
  2. #2
    Thanks for providing a sample to reproduce the problem. We are investigating.

    I believe the issue is related to the DOM objects for the Window and Checkbox elements not being available at the time you're calling. Switching the order of your js calls should fix the issue, but we'll have to run a few tests to confirm.

    <Click Handler="App.winme.show();App.bbbb.setValue('1')" />
    I believe there is also a setting on the Window to ensure it's DOM is created even if it's not visible on page_load.
    Geoffrey McGill
    Founder
  3. #3
    I just tried to change the order and it made no difference.

    as a side note, in my "production" version, i ALSO added SHOW listener on the Window. Then i tried to check it from the handler so that i was sure the window was "shown" before attempting to check the boxes. that didnt work either!!

    thanks,
    /Z
  4. #4
    Hello @Z!

    There's a good news and a bad news about this.

    Bad news first, you found a bug. Even if I go down the path to the Sencha documentation, I see it claims to accept 'on', 'true', and '1', among other options. Yet if I edit the very sample code in the documentation to set to the string values instead of just true, the checkboxes won't get checked.

    Good news is, just pass the constant true and you should get the field checked.

    We've logged issue #1635 to track this defect and will post an update here as soon as we have news about the matter.

    Let us know if using the literal true is not an option for you in the meanwhile.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 5
    Last Post: May 20, 2019, 2:15 PM
  2. Replies: 1
    Last Post: May 08, 2015, 7:12 PM
  3. [CLOSED] Checking the header checkbox automatically.
    By arjunrvasisht in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 06, 2015, 3:52 PM
  4. [CLOSED] checking a grid checkbox with the spacebar
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 06, 2011, 5:46 PM
  5. [CLOSED] Open window from checkbox
    By Adrian in forum 1.x Help
    Replies: 2
    Last Post: Aug 26, 2008, 7:48 PM

Posting Permissions