Class TIWBSCustomAsyncEvent

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TIWBSCustomAsyncEvent = class(TCollectionItem)

Description

Hierarchy

  • TCollectionItem
  • TIWBSCustomAsyncEvent

Overview

Methods

Public constructor Create(Collection: TCollection); override;
Public destructor Destroy; override;
Public function GetScript: string;
Public procedure Assign(Source: TPersistent); override;
Public procedure ParseParam(AScript: TStringList);
Public procedure RegisterEvent(AApplication: TIWApplication; const AComponentName: string);

Properties

Published property AutoBind: boolean read FAutoBind write FAutoBind default False;
Published property CallBackParams: TStringList read FCallBackParams write SetCallBackParams;
Published property EventName: string read FEventName write SetEventName;
Published property EventParams: string read FEventParams write FEventParams stored IsEventParamsStored;
Published property OnAsyncEvent: TIWAsyncEvent read FAsyncEvent write FAsyncEvent;

Description

Methods

Public constructor Create(Collection: TCollection); override;
 
Public destructor Destroy; override;
 
Public function GetScript: string;

Return the javascript code necessary to execute the callback

Public procedure Assign(Source: TPersistent); override;
 
Public procedure ParseParam(AScript: TStringList);

Search in a script and replace params with same name as EventName with the js code necessary to execute the callback.

Public procedure RegisterEvent(AApplication: TIWApplication; const AComponentName: string);

Register the callback in the server. Is for internal use, don't use it.

Properties

Published property AutoBind: boolean read FAutoBind write FAutoBind default False;

Specifies if the delphi event will be automatically binded to the jQuery control with the EventName specified. If true, the event will be automatically attached to the rendered object.
If false, you need to manually bind the event.
To manually bind an event in delphi code you could do:

IWBSExecuteJScript(MyObject.JQSelector+'.on("api.event.name", function(event, param1, param2) {'+MyObject.CustomAsyncEvents[0].GetScript+'})');

or you can add in the script property:

$("#{%htmlname%}").on("api.event.name", function(event, param1, param2) { {%eventname%} });

Published property CallBackParams: TStringList read FCallBackParams write SetCallBackParams;

Mainteins a list of pairs names=values to translate the EventParams to the params pased to the OnAsyncEvent

Published property EventName: string read FEventName write SetEventName;

Specifies the event name, if AutoBind = True, the EventName should be exactly the name of the jQuery event, if AutoBind = False you can set any name here and use the correct one when you manually register it.

Published property EventParams: string read FEventParams write FEventParams stored IsEventParamsStored;

Specifies a list of comma separated names of params that the event will pass to the callback function.
This params names are defined in the api of the object you are using.

Published property OnAsyncEvent: TIWAsyncEvent read FAsyncEvent write FAsyncEvent;

Occurs when the defined JQ event is triggered


Generated by PasDoc 0.14.0.