[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
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
RE: [FIXED] Button AjaxEvent Success
Code:
<%@ 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
RE: [FIXED] Button AjaxEvent Success
Hi Timothy,
The Success handler should be function
Code:
<Click OnEvent="btnDemo_Click" Success="function(){alert('Timothy wuz here')}" />
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
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
Code:
<Click OnEvent="btnDemo_Click" Success="alert('Timothy wuz here')" />
Code:
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.
RE: [FIXED] Button AjaxEvent Success