PDA

View Full Version : [FIXED] Button does not show if AutoPost set to false...



kraghavk
Apr 16, 2008, 11:46 AM
Hi,

I'd like to thank the Coolite team for giving us a great project. I've been fascinated with the Ext JS for a long time now but could never use it in my projects because of my inexperience in javascript.

I hope to use this library, but since it is missing a lot of controls from the Ext JS (datagrid mainly!), I have decided to wait for another release or so before I can get to use it.

But in the mean time I have also decided to work on a few demos to familiarize myself with the library and, these demos could also help me convince my boss to use the library. Anyways, as I am doing this, I will keep posting any bugs. Here is the first one from me:

The button control does not show up on the page if AutoPost is set to false!!!



<cool:Button ID="Button1" runat="server" AutoPostBack="False" Text="Show Window">
</cool:Button>


I am running windows vista and testing the app on Mozilla Firefox v2.0.0.13

geoffrey.mcgill
Apr 16, 2008, 4:36 PM
Hi there,

Thanks for reporting the bug. The button was not redering because a JavaScript error was generated when the AutoPostBack property is set to "false". In general, if a JavaScript error is thrown, the coolite/ext controls may not render anything to the page.

With the Button, we set the Click event property of ClientEvents to the AutoPostBack function. When AutoPostBack was set to false, we were mistakingly still setting the Click event, although not passing in a function to fire. This caused a js error to be thrown.

With version 0.4.*, you can work around this problem be setting the Click event to "Ext.emptyFn" or any custom function.

Example


<cool:Button runat="server" Text="Submit" ID="Button1" AutoPostBack="False">
<ClientEvents>
<Click Handler="Ext.emptyFn" />
</ClientEvents>
</cool:Button>


We caught the problem just after the 0.4.1 release and I've confirmed that it's working fine for the 0.5 build.

For reference, with the 0.5 release we've changed a few things and the following code sample demonstrates how the above example would be coded in 0.5.

Example


<ext:Button runat="server" Text="Submit" ID="Button1">
<Listeners>
<Click Handler="Ext.emptyFn" />
</Listeners>
</ext:Button>


With 0.5 you also do not need to set the AutoPostBack property to false, if you set a custom Click event.

Example


<ext:Button runat="server" Text="Submit" ID="Button1">
<Listeners>
<Click Handler="function(){ Ext.Msg.alert('Hello', 'You Clicked Me'); }" />
</Listeners>
</ext:Button>


Hope this helps.

kraghavk
Apr 17, 2008, 9:09 AM
Hi geoffry.mcgill,

Thanks for the explanation for the bug report. But looking at the following code block in your reply, I have a concern that your future release might not be backwards compatible!


<cool:Button runat="server" Text="Submit" ID="Button1" AutoPostBack="False">
<ClientEvents>
<Click Handler="Ext.emptyFn" />
</ClientEvents>
</cool:Button>



<ext:Button runat="server" Text="Submit" ID="Button1">
<Listeners>
<Click Handler="Ext.emptyFn" />
</Listeners>
</ext:Button>


Especially, cool and the ext part. Not that I have hundreds of pages to fix, but how can I be sure that such breaking changes won't happen frequently in future releases!


Thanks,
kraghavk

geoffrey.mcgill
Apr 18, 2008, 3:50 PM
Hi kraghavk,

Yes, there will be a few breaking changes with the 0.5 release. Obviously we would rather not introduce any breaking changes, but you can expect some 'corrections' in each release until we hit version 1.0. There will be no backwards compatibility logic added to the toolkit until we have reached at least final version 1.0 release. And in general, the "breaking changes" will involve just renaming properties.

With version 0.5 we're renaming the following:


<LI>TagPrefix is now <ext: from <cool:</LI>
<LI>Assembly/Namespace is now Coolite.Ext.Web, from Coolite.Web.UI</LI>
<LI><ClientEvents> is now <Listeners></LI>
<LI>The <Items> node/collection in TabPanel is now <Tabs>
</LI>Adjusting for all four breaking changes will require a simple search-and-replace. The logic or functionality of each has not changed.