ext:Window Hide Handler
*NEW - Coolite Toolkit Version 0.6.0 now available for download or view examples.
 

Coolite Forums

Welcome Guest ( Login | Register )
 
ext:Window Hide Handler
Subscribe
Last Login: 11/5/2008 11:08:46 AM
Posts: 52,
Posted 6/16/2008 10:14:34 AM

Group: Coolite Early Adopter

How do I attach a server-side handler to ext:Windows's hide event? I need to perform some server-side action when the window is hidden.

Also, from what I understand, if the CloseAction is 'Close' (default), there is no way to open this window after it had been closed? Therefore I should use CloseAction="Hide" if I need the ability to reopen the window (e.g. on button click)?

Thank you!

Last Login: Today @ 3:11:47 PM
Posts: 1,173,
Posted 6/16/2008 11:55:33 AM

Group: Core Development Team
Very good and very interesting question. Do you need to do a full postback? or just an Ajax request to set/get simple information from server?

You are correct re: the CloseAction. If "Close", Window will be destroyed and not available again. If "Hide", you can re-open when .Show() is called. Mind you, that is all client-side. If you are making a full postback to the server, then you will be able to re-create the Window if you "Close".
--
Geoffrey McGill
Coolite Inc.
Core Developer
twitter [personal] [coolite]
Last Login: 11/5/2008 11:08:46 AM
Posts: 52,
Posted 6/16/2008 1:33:37 PM

Group: Coolite Early Adopter
Very good and very interesting question. Do you need to do a full postback? or just an Ajax request to set/get simple information from server?

Right now I need a full postback, but it would be nice to know both options

Thanks, Geoffrey!
Last Login: 11/5/2008 11:08:46 AM
Posts: 52,
Posted 6/18/2008 8:40:36 AM

Group: Coolite Early Adopter

I hate to be annoying, but was curious if it is possible to have a server-side handler for the window's hide event with the current Coolite...

Thanks!

Last Login: Today @ 3:11:47 PM
Posts: 1,173,
Posted 6/18/2008 9:51:16 AM

Group: Core Development Team
I apologize for the delay in getting back to you.

At the moment there is no server-side event attached to the Window Close event. We're investigating a solution which would allow for ajax binding to any of the 150+ client-side events within the framework. But, that functionality is not going to be available until a future release.
--
Geoffrey McGill
Coolite Inc.
Core Developer
twitter [personal] [coolite]
Last Login: 11/5/2008 11:08:46 AM
Posts: 52,
Posted 6/18/2008 10:38:17 AM

Group: Coolite Early Adopter

Thanks for the info, Geoffrey!
Hope 0.6 is coming soon. Can't wait to try the grid

Last Login: 9/1/2008 8:20:00 PM
Posts: 2,
Posted 8/4/2008 6:52:43 PM

Group: Coolite Early Adopter
I also needed server side events for the window close/hide so as an interim solution I wired up the client side events to an asp.net script callback and passed the event name in as an argument.  It's a hack but it gets the job done! Hope it helps someone. 

<ext:Window ID="Window1" runat="server" CloseAction="Hide" Collapsible="true" icon="Application" Title="Title">
 <Listeners>
   <Hide Handler="RelayEvent('hide','')" />
   <Move Handler="RelayEvent('move','')" />
 </Listeners>
</ext:Window>



Partial Class _Default
  Inherits System.Web.UI.Page
  Implements ICallbackEventHandler

Private _callbackArg As String

P
rotected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  Dim cbReference As String
  cbReference = Page.ClientScript.GetCallbackEventReference(Me, "arg", "ReceiveServerData", "context")
  Dim callbackScript As String
  callbackScript = "function RelayEvent(arg, context)" & "{" & cbReference & "; }"
  Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "RelayEvent", callbackScript, True)
End Sub

Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
  Select Case _callbackArg
  Case "hide"
    Return "Hidden"
  Case "move"
    Return "Moved"
  Case Else
    Return _callbackArg
  End Select
End Function

Public
Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
   _callbackArg = eventArgument
End Sub
End
Class




<script type="text/javascript">
function ReceiveServerData(arg, context)
{
  document.getElementById(
'Text1').innerText = arg;
}



Thanks,
Nathan

Last Login: Today @ 3:11:47 PM
Posts: 1,173,
Posted 8/5/2008 5:17:49 PM

Group: Core Development Team
The new <AjaxEvents> functionality is almost ready and will be available with the v0.6 release.

The following sample demonstrates how a <Hide> AjaxEvent is added to an <ext:Window>.

Example

<ext:Window 
    ID="Window1"
    runat="server"
    Title="Window with AjaxEvent"
    Closable="true"
    CloseAction="Hide">
    <AjaxEvents>
        <Hide OnEvent="Window1_Hide" />
    </AjaxEvents>
</ext:Window>


The "OnEvent" delegate is fired server-side using an ajax request (async postback, callback) when the Window is closed.

The following sample demonstrates the server-side code required to wire up the event handler.

Example

protected void Window1_Hide(object sender, AjaxEventEventArgs e)
{
    // the Window was closed.
    // do something...

    this.Window1.Html = "This Window has been previously closed.";
}


There's a huge amount of functionality built into the new <AjaxEvents> and this sample is just a small taste.
--
Geoffrey McGill
Coolite Inc.
Core Developer
twitter [personal] [coolite]
Last Login: 9/1/2008 8:20:00 PM
Posts: 2,
Posted 8/5/2008 6:36:32 PM

Group: Coolite Early Adopter
 Very nice! I have to say, Coolite/ExtJS is the best performing asp.net toolkit I've worked with so far.  Do you have an ETA for the v0.6 release?

Thanks,
Nathan
« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -8:00, Time now is 4:27pm