[FIXED] [V0.6] NumberField and AjaxEvents

  1. #1

    [FIXED] [V0.6] NumberField and AjaxEvents

    Hello,

    The example below demonstrates that the NumberField is not being set on AjaxEvents ComboBox change event.

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    protected void drpBox_Change(object sender, AjaxEventArgs e)
    {
        txtName.Text = "Timothy";
        txtPrice.Number = 1;
    }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
            <ext:ScriptManager ID="ScriptManager2" runat="server" Theme="Gray" />
            <ext:TabPanel ID="TabPanel" runat="server" ActiveTabIndex="0" AutoPostBack="True" AutoHeight="True" DeferredRender="True">
                <Tabs>
                    <ext:Tab ID="Tab1" runat="server" Title="Tab1">
                        <Content>
                            <ext:ComboBox ID="drpBox" runat="server">
                                <Items>
                                    <ext:ListItem Text="1" />
                                    <ext:ListItem Text="2" />
                                </Items>
                                <AjaxEvents>
                                    <Change OnEvent="drpBox_Change" />
                                </AjaxEvents>
                            </ext:ComboBox>
                            <ext:TextField ID="txtName" runat="server" />
                            <ext:NumberField ID="txtPrice" runat="server" AllowDecimals="True" DecimalPrecision="2" />
                        </Content>
                    </ext:Tab>
                </Tabs>
            </ext:TabPanel>
        </form>
    </body>
    </html>
    Cheers,
    Timothy
  2. #2

    RE: [FIXED] NumberField and AjaxEvents

    Hi Timothy,



    the fix in SVN


  3. #3

    RE: [FIXED] NumberField and AjaxEvents

    Thanks vlad!

    Cheers,
    Timothy
  4. #4

    RE: [FIXED] NumberField and AjaxEvents

    Hello,

    Ext:HiddenField is the same.

    Cheers,
    Timothy
  5. #5

    RE: [FIXED] NumberField and AjaxEvents

    Also the same for Ext:Store ... if I bind the data doesn't change.
  6. #6

    RE: [FIXED] NumberField and AjaxEvents

    I cleaned up some of the code re: how the Form Fields set their value during an AjaxEvent. The <ext:HiddenField> should be working properly now. The same problem existed in <ext:DateField> and <ext:DatePicker>.

    The cause of the defect is that a small snippit of JavaScript must be dynamically created during the AjaxEvent and returned to be executed on the client. By default when you set a property during the Ajax event, the snippit returned will just try to set the property value in JavaScript. For example, by default, if you set the .Text property of the <ext:TextField> to "testing", the snippit returned will be "this.TextField1.text = \"testing\"". Unfortunately that snippit of JavaScript will not actually update the <input> field and the TextField will appear to not change.

    Updating some properties with the client widget requires a function to be called on the client. To change the .Text property of the <ext:TextField> on the client, you must call the .SetValue() function.

    We've created a mechanism within the controls to enable a custom Method or custom snippit to be returned by setting the [AjaxEventUpdate] Attribute. For example, the .Text property of the <ext:TextField> requires the .SetValue() Method to be called, so the [AjaxEventUpdate(MethodName="SetValue")] is added to the .Text property.

    The AjaxEventUpdate Attribute above instructs the serializer to call the .SetValue() Method when the .Text property is set during an AjaxEvent.

    Other options for the AjaxEventUpdateAttribute include:

    [AjaxEventUpdate(MethodName = "SetTitle")] // Call a Method
    [AjaxEventUpdate(Script = "this.{0}.setTitle({1});")] // Supply a custom script Template. Two values passed, 1. .ClientID &amp; 2. the Json Serialized property value. 
    [AjaxEventUpdate] // AutoGenerate, returns a property setter
    Properties that do not update properly on the respose from an AjaxEvent do not have the proper [AjaxEventUpdate] attribute applied.

    We made an initial pass through the Toolkit setting many of the required [AjaxEventUpdate] attributes, but there's still many that require hand modification.

    If you find a property that does not update on the client after the AjaxEvent response, please let us know. Revising the [AjaxEventUpdate] Attribute will almost always be the solution.

    Geoffrey McGill
    Founder
  7. #7

    RE: [FIXED] NumberField and AjaxEvents

    Timothy (9/10/2008)Also the same for Ext:Store ... if I bind the data doesn't change.
    Can you create a new thread for this bug report? I'm marking the original request as [FIXED].
    Geoffrey McGill
    Founder
  8. #8

    RE: [FIXED] NumberField and AjaxEvents

    Great thanks Geoffrey.

    Will do.

    Timothy

Similar Threads

  1. Replies: 4
    Last Post: Jan 23, 2012, 11:31 AM
  2. Replies: 2
    Last Post: May 02, 2010, 1:54 PM
  3. [FIXED] [V0.7] AjaxEvents bug
    By amin_itm in forum Bugs
    Replies: 5
    Last Post: Dec 01, 2008, 2:45 AM
  4. Replies: 1
    Last Post: Sep 30, 2008, 11:27 AM
  5. Replies: 5
    Last Post: Sep 17, 2008, 6:45 PM

Posting Permissions