PDA

View Full Version : [CLOSED] Multiple Trigger in a Window



GuS
Aug 22, 2008, 3:57 PM
Hi!!


My question is: It is possible to add multiple triggers to ONE Window? Example.. I have like 3 search Buttons that each open a Window to show a search result into a GridView (currently I have 3 Windows, one per each Button).
So, is possible to add only One Window with triggers to those 3 buttons?

Thanks.

Vladimir
Aug 22, 2008, 4:30 PM
Hi Gus!

Yes, sure, you can do it.
Please see next example




<ext:Window runat="server" ID="Window1"></ext:Window>
<ext:Button runat="server" ID="Button1">
<Listeners>
<Click Handler="{Window1}.show({Button1});" />
</Listeners>
</ext:Button>
<ext:Button runat="server" ID="Button2">
<Listeners>
<Click Handler="{Window1}.show({Button2});" />
</Listeners>
</ext:Button>
<ext:Button runat="server" ID="Button3">
<Listeners>
<Click Handler="{Window1}.show({Button3});" />
</Listeners>
</ext:Button>


Let me explain syntax. The window has the 'show' js function. If you want to open the window then need to call this function. You can pass the trigger control (for animation) or just pass 'null' (without the quotes, of course). You can ask why need curly brackets. The client id's of control can be different from the server id's. When you wrapping to curly brackets the Coolite toolkit will change them to real id's

Please pay attention that in the next release (v0.6) syntax will be change, instead of {Window1} need to use # {Window1}

GuS
Sep 01, 2008, 3:05 PM
Vladimir,

Thanks for the tip! That worked.
But now i have one problem and one question:

1st. I have problems using Coolite buttons (indeed since this version if i remember correctly). This error showed when i click on a Coolite button (no matter if i use triggers or not... even when i put only a button with no fuctions on it):

http://pastebin.com/f69aef6cc

Now, this is on Firefox. In IE it shows the window (lets assume that i launch a window when pressing the button) and after a less than a second it closes and the browser shows "Error on Page" in the statusbar.


This is my code:



<ext:Button ID="SearchButton1" runat="server" Text="Buscar">
<Listeners>
<Click Handler="{Window1}.show({SearchButton1});" />

</Listeners>
</ext:Button>




<ext:Window
ID="Window1"
Title="Resultados"
runat="server"
Width="550px"
Height="400px"
AutoShow="false"
CloseAction="Hide"
Collapsible="true"
Show&#111;nload="False">
<Content>
<ext:Panel
ID="Panel3"
runat="server"
Title="Reportes por Curso"
Height="400px"
BodyStyle="padding: 6px;"
AutoLoad="searchResult.aspx"/>
</Content>
</ext:Window>


2nd. My question is, that now the window has no transision effect when i open it (since i use this trigger method). How i could do this?

Thanks in advance!

Cheers.

geoffrey.mcgill
Sep 01, 2008, 4:19 PM
1st. Please see http://forums.ext.net/showthread.php?postid=1234.aspx

2nd. Try the following <Click> Handler


<Click Handler="{Window2}.show(this.el);" />

Please note, after the v0.6 release, the above code would change to the following syntax


<Click Handler="#{Window2}.show(this.el);" />

The only change is that the TokenID is now prefixed with a "#".

Hope this helps.

GuS
Sep 01, 2008, 7:24 PM
Hi!

The animation (of the window) in my 2nd doubt/problem is solved, but the same error occurs with this. :(

Any other tip?

Thanks.

geoffrey.mcgill
Sep 01, 2008, 7:40 PM
I'm not sure what you mean by "but the same error occurs with this"? Can you explain further?

GuS
Sep 01, 2008, 9:28 PM
I meant, with the solution you gave me... I press the button, the window appears and the error page came out.
Now, i've tested to delete the Autoload of the Window, and when i press the button, the window appears but it dissappear again after a second.

Thanks.

GuS
Sep 02, 2008, 3:39 PM
Hello Again!

I saw that the error (posted in the pastebin site) is caused by the AutoLoad when i use an aspx file in it.
Maybe i've made mistakes in that file? Posting the code:




<%@ Page Language="VB" AutoEventWireup="false" CodeFile="searchResult.aspx.vb" Inherits="searchResult" %>

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="searchresult" runat="server">


<p>Aqu&amp;iacute; se posicionarķa la Tabla o Grid con el resultado de la b&amp;uacute;squeda...</p>
<asp:GridView ID="searchGrid1" runat="server" Height="56px" Width="550px"
AllowPaging="True" BorderStyle="Solid" AutoGenerateSelectButton="True">
</asp:GridView>

<asp:GridView ID="searchGrid2" runat="server" Height="56px" Width="550px"
AllowPaging="True" BorderStyle="Solid" BorderWidth="1px">
</asp:GridView>
<asp:Label ID="searchStatusLabel" runat="server" Width="550px" Height="48px"
BorderStyle="Solid" BorderWidth="1px"></asp:Label>


</form>
</body>
</html>


By the way, about the Coolite window being closed after pressing the button to show it, this behavior does not happen if i use an simple aspx button.

Thanks in advance for any tip/help.

Cheers.

geoffrey.mcgill
Sep 02, 2008, 4:25 PM
Please set .AutoPostBack="false" on your <ext:Button>.

By default the <ext:Button> will do a postback when clicked, thereby refreshing the page.

Hope this helps.

GuS
Sep 02, 2008, 6:50 PM
Hi!

Great! that solved the problem, even the error on aspx page AutoLoad :D

Thanks Geoffrey! and sorry for newbie questions... I am not much aspx developer or so... (i develop more GUI apps). And i have low js practice and less about Ext JS/Coolite.

Cheers!

GuS
Sep 03, 2008, 1:14 PM
Hi again!

A small detail and question: what if i need the AutoPostBack for the button (for the form data)? It is normal that the Window closes if i not set the AutoPostBack to True?

Thanks.

geoffrey.mcgill
Sep 07, 2008, 7:31 AM
Hi Gus,

Currently the <ext:Window> does not maintain show/hide state or positioning between postbacks. This is a feature we're hoping to introduce in a future version. 


You might want to investigate using the <AjaxEvents> for form submission. When the Page is submitted using an <AjaxEvent> the Window will maintain it's show/hide status and positioning.


Hope this helps.