Widget
Wisej.Web.Widget
Last updated
Wisej.Web.Widget
Last updated
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.2.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. (Default: None
)
Boolean: Enables or disables the browser's context menu. (Default: False
)
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.
C# can also attach to client side events fired by the third party widget by simply adding an handler to the event name prefixed by "on". VB.NET cannot attach to dynamic events and must insted use the method AddListener to attach an event listener to an event fired by the widget.
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 third party libraries, 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.
VB.NET muse use this method to attach an event handler to the widget's events.
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.
Bindable components implement this interface.
Controls that support drag & drop operations 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.
expression