[OPEN] [#1383] [3.3.0] Checkbox value lag in DirectMethod

  1. #1

    [OPEN] [#1383] [3.3.0] Checkbox value lag in DirectMethod

    Hi
    I have encountered an old defect that is should have been fixed in version 2, but now appears in version 3.3.
    See old thread http://forums.ext.net/showthread.php...n-DirectMethod


    Same example code as in the example:
    <%@ Page Language="C#" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    <!DOCTYPE html>
    <script runat="server">
        [DirectMethod]
        public void showValue()
        {
               X.Msg.Alert("Status", String.Format("Value change event checkbox = {0}",chbDelete.Checked)).Show();
        }
    </script>
    <html>
    <head id="Head1" runat="server">
        <title>Checkbox</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
             <ext:FormPanel ID="fpQuery" runat="server">
                    <Items>
                    <ext:Checkbox runat="server" ID="chbDelete" FieldLabel="Click here !">
                        <Listeners>
                             
                            <Change Handler="App.direct.showValue();" Delay="1"/>
                        </Listeners>
                    </ext:Checkbox>
                </Items>
           </ext:FormPanel>
        </form>
    </body>
    </html>
    Best regards
    Mikael
    Last edited by fabricio.murta; Sep 19, 2016 at 8:37 PM.
  2. #2
    Hello @Jurke!

    What specifically is the problem you are talking about? To me the value seems coherent to the change made to the check box.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi
    The problem is that if I remove the Delay="1", the message in the messagebox:
    X.Msg.Alert("Status", String.Format("Value change event checkbox = {0}",chbDelete.Checked)).Show();
    shows the opposite of the visual status of the checkbox. So if I check the checkbox the message say false and vice versa.
    Can you reproduce that?

    Regards
    Mikael
  4. #4
    Yes, alright! I can reproduce that.

    But what you think of this alternative approach that does not require delay and don't mix up listeners with direct events:

    <%@ Page Language="C#" %>
    <!DOCTYPE html>
    <script runat="server">
        public void handleChange(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Status", String.Format("Value change event checkbox = {0}", chbDelete.Checked)).Show();
        }
    </script>
    <html>
    <head id="Head1" runat="server">
        <title>Checkbox</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
             <ext:FormPanel ID="fpQuery" runat="server">
                    <Items>
                    <ext:Checkbox runat="server" ID="chbDelete" FieldLabel="Click here !">
                        <DirectEvents>
                            <Change OnEvent="handleChange" />
                        </DirectEvents>
                    </ext:Checkbox>
                </Items>
           </ext:FormPanel>
        </form>
    </body>
    </html>
    Tested and working fine on 2.x, 3.x and current 4.x versions.

    But thanks for providing the feedback, we should take a look for what brought back this issue and what would be needed to fix it.

    Anyway, we've logged issue #1383 to track & fix this bug! Hope one of the alternatives (either use a delay or use a direct event) may work for you in the meanwhile!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hi!
    Good that you where able to reporoduce it. In my case I need it to be a direct method as I want call it from client side aswell. So Im going to stick with the delay property.
    Thanks for your example code.

    /Mikael
  6. #6
    Alright! We will update here as soon as we have implemented the fix, hopefully the same that was applied in the 2.x version -- if that fix still applies here. May not be the case, due to the number of changes in click/tap handling from the versions.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Feb 02, 2015, 8:58 AM
  2. Replies: 1
    Last Post: Apr 30, 2014, 8:03 PM
  3. [CLOSED] Checkbox Checked value in DirectMethod
    By CarWise in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 25, 2013, 9:17 AM
  4. [CLOSED] Difference between DirectMethod , DirectEvent, Static DirectMethod
    By syllabusarq in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2011, 11:37 AM
  5. [CLOSED] set Checkbox in DirectMethod
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 15, 2010, 1:32 PM

Posting Permissions