Wisej.Web.WebRequestHandler
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.0.0.0)
Represents the method that will handle the WebRequest event of a Widget control.
Name | Type | Description |
---|---|---|
Name | Description |
---|---|
Wisej.Web.WebRequestEventArgs
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.0.0.0)
Provides data for the WebRequest event.
Initializes a new instance of the WebRequestEventArgs class with the specified error message.
Name | Type | Description |
---|---|---|
HttpRequest: Returns the current HttpRequest.
HttpResponse: Returns the current HttpResponse.
Wisej.Web.Widget
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.0.0.0)
Provides a generic widget that can use most third party javascript widgets.
See the InitScript property for a detailed description on how to initialize the imported widget.
Initializes a new instance of the Widget class.
BorderStyle: Indicates the border style for the control.
Boolean: Enables or disables the browser's context menu.
String: Returns or sets the initialization script.
The initialization script is called after the widget is created and before it is rendered by the browser. It is here that the code should initialize the third party widget, hook up any event, and save any reference it may need. The initialization function is named "init" and must be declared like this:
The update function is named "update", it is optional, and must be declared like this:
The "options" parameter is optional. It contains a javascript map with all the options defined in the Options property. Within the init function you can refer to the Wisej widget class using "this" and to the HTML element using "this.container". To fire an event back to the server, use "this.fireWidgetEvent() as show in the sample code below:
On the server side, you can handle the WidgetEvent and receive any data passed in the "fireWidgetEvent" call in the Data dynamic object.
Object: Returns a DynamicObject that can convert any method call into the equivalent JavaScript call targeting the third party "widget" object.
An application can invoke any method on the wrapped third party widget by using the Instance property. Dynamic method calls are automatically transformed to JavaScript client calls.
Boolean: Returns whether the JavaScript widget has been initialized.
Object: Returns or sets a dynamic object that is passed to the init(options) function upon initialization of the widget and to the update(options, old) when updating the widget.
List<Package>: List of packages required to run this widget.
Each package is a URL to either a JavaScript or a CSS file. The packages are loaded in the order they are listed. If a script depends on another script, it should be declared after the script it depends on, i.e.: Query usually if the first script in the package list. Wisej uses the name of the package to cache it and load it only once. It's important that you use consistent names when creating multiple widgets in order to load the shared packages only once.
String[]: Returns or sets the list of events that are fired by the widget wrapper.
Defines the list of events that the widget wrapper can fire. You have to add the code that handles the third party widget's events and fire a server event back to this widget wrapper. If your initialization code fires the event correctly and the event is registered in the WiredEvents list, the application code can attach a listener to the dynamic Instance object like any native event.
For the sample code above to receive the "areaClick" event you have to handle the third party widget event and fire a Wisej event. The syntax for the handler registration depends on each wrapped third party widget: some may use native events, other may use jQuery, and others may use callback methods.
The list of the wired events that the server component expects to receive is available on the client side wrapper using the events array: this.getEvents(). [Since 2.5.31] You can attach to the event without having to register it with the WiredEvents collection when you prefix the handler with "on". i.e. this.Instance.onPointClick += new WidgetEventHandler(onPointClick). Wisej will try to attach to the "pointClick" event automatically removing the "on" prefix. When you attach the listener Wisej will automatically add it to the WiredEvents collection. Additionally, instead of having to iterate the this.getEvents() collection in the widget's initScript, you can override "_addListener", "_removeListener", "_getEventData".
Registers the event handler to listen to the event eventName fired by the third party widget.
Using AddListener only registers the server side handlers and adds the eventName to the list of WiredEvents. However, the client side wiring of the client event and the firing of the event back to the server must Throws:
ArgumentNullException eventName or handler is null.
Removes the event handler for the eventName fired by the third party widget.
Throws:
ArgumentNullException eventName or handler is null.
EventHandler Fired when the widget is created on the client.
WebRequestHandler Fired when the widget used the "postbackUrl" to retrieve data from this control.
Name | Description |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Name | Description |
---|---|
sender
The source of the event.
e
A WebRequestEventArgs that contains the event data.
Fired when the widget used the "postbackUrl" to retrieve data from this control.
Represents the method that will handle the WebRequest event of a Widget control.
eventName
Name of the event fired by the third party widget.
handler
Function that handles the event on the server side.
expression
Optional expression to process the event data: i.e. "{x:e.x, y:x.y}".
eventName
Name of the event fired by the third party widget.
handler
Function that handles the event on the server side.
Bindable components implement this interface.
All wisej components implement this interface.
All wisej controls derived from the Control class must implement this interface.
Represents a Wisej component that is capable of handling postback requests from the client.
Allows an object to serialize itself.
context
The current HttpContext.