[FIXED] [V0.6] Button AjaxEvent Success

  1. #1

    [FIXED] [V0.6] Button AjaxEvent Success

    Question, should the Success property of the Click AjaxEvent for Ext:Button not fire after the OnEvent returns? As of right now, I have an alert in the Success and it fires before my code behind does :)

    Not sure if this is intended or a bug.

    Cheers,
    Timothy
  2. #2

    RE: [FIXED] Button AjaxEvent Success

    Hi Timothy,

    Can you post full source code of example? The Success handler must be fired after server side code execution
    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: [FIXED] Button AjaxEvent Success

    <%@ 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 btnDemo_Click(object sender, AjaxEventArgs e)
    {
        lblTest.Text = "Life is over ...";
    }
    </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:Button ID="btnDemo" runat="server" AutoPostBack="False" Text="Demo">
                <AjaxEvents>
                    <Click OnEvent="btnDemo_Click" Success="alert('Timothy wuz here')" />
                </AjaxEvents>
            </ext:Button>
            <ext:Label ID="lblTest" runat="server" Text="Waiting ..." />
        </form>
    </body>
    </html>
    Cheers,
    Timothy
  4. #4

    RE: [FIXED] Button AjaxEvent Success

    Hi Timothy,

    The Success handler should be function

     <Click OnEvent="btnDemo_Click" Success="function(){alert('Timothy wuz here')}" />

    Vladimir Shcheglov
    Sr. Developer
  5. #5

    RE: [FIXED] Button AjaxEvent Success

    Oops, crap!

    Thanks vlad for pointing that out :)

    Can we get a SuccessFn or something so we don't need to? Lazy me I know ...

    Cheers,
    Timothy
  6. #6

    RE: [FIXED] Button AjaxEvent Success

    Hi Timothy,

    We're changing the "Failure" and "Success" properties of the AjaxEvent to automatically wrap the value in a function template. Two parameters will be passed into the function: "response" and "options".

    The following sample demonstrates setting the "Success" property and below shows what will be rendered to the client.

    Example

    <Click OnEvent="btnDemo_Click" Success="alert('Timothy wuz here')" />
    function(response, options) { alert('Timothy wuz here') }
    The code should be committed to svn before the end of the day and will be available with v0.6.

    Hope this helps.
    Geoffrey McGill
    Founder
  7. #7

    RE: [FIXED] Button AjaxEvent Success

    Great, thanks Geoffrey!

Similar Threads

  1. Replies: 6
    Last Post: May 26, 2009, 4:03 PM
  2. Replies: 7
    Last Post: Feb 13, 2009, 4:27 PM
  3. [FIXED] [V0.8.0] Bug in Coolite.AjaxEvent
    By abertram in forum Bugs
    Replies: 5
    Last Post: Jan 23, 2009, 11:52 AM
  4. Replies: 4
    Last Post: Dec 04, 2008, 8:56 AM
  5. [FIXED] [V0.6] AjaxEvent not working
    By Jurke in forum Bugs
    Replies: 3
    Last Post: Sep 09, 2008, 12:13 PM

Posting Permissions