mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:29:19 +02:00
* Added OnChange and OnChangeCS events to THTMLCustomDatasetContentProducer
git-svn-id: trunk@14876 -
This commit is contained in:
parent
7d16a2ded2
commit
c5c0bab10b
@ -281,6 +281,8 @@ type
|
|||||||
THTMLCustomDatasetContentProducer = class (THTMLContentProducer)
|
THTMLCustomDatasetContentProducer = class (THTMLContentProducer)
|
||||||
private
|
private
|
||||||
FDatasource: TDatasource;
|
FDatasource: TDatasource;
|
||||||
|
FOnChange: THandleAjaxEvent;
|
||||||
|
FOnChangeCS: TCSAjaxEvent;
|
||||||
FOnWriteFooter: TWriterEvent;
|
FOnWriteFooter: TWriterEvent;
|
||||||
FOnWriteHeader: TWriterElementEvent;
|
FOnWriteHeader: TWriterElementEvent;
|
||||||
FOnWriteRecord: TWriterEvent;
|
FOnWriteRecord: TWriterEvent;
|
||||||
@ -291,6 +293,8 @@ type
|
|||||||
procedure DoWriteHeader (aWriter : THTMLWriter; var el : THTMLCustomElement); virtual;
|
procedure DoWriteHeader (aWriter : THTMLWriter; var el : THTMLCustomElement); virtual;
|
||||||
procedure DoWriteFooter (aWriter : THTMLWriter); virtual;
|
procedure DoWriteFooter (aWriter : THTMLWriter); virtual;
|
||||||
procedure DoWriteRecord (aWriter : THTMLWriter); virtual;
|
procedure DoWriteRecord (aWriter : THTMLWriter); virtual;
|
||||||
|
function GetEvents: TEventRecords; override;
|
||||||
|
procedure HandleAjaxRequest(ARequest: TRequest; AnAjaxResponse: TAjaxResponse); override;
|
||||||
public
|
public
|
||||||
function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; override;
|
function WriteContent (aWriter : THTMLWriter) : THTMLCustomElement; override;
|
||||||
Property OnWriteHeader : TWriterElementEvent read FOnWriteHeader write FOnWriteHeader;
|
Property OnWriteHeader : TWriterElementEvent read FOnWriteHeader write FOnWriteHeader;
|
||||||
@ -298,6 +302,8 @@ type
|
|||||||
Property OnWriteRecord : TWriterEvent read FOnWriteRecord write FOnWriteRecord;
|
Property OnWriteRecord : TWriterEvent read FOnWriteRecord write FOnWriteRecord;
|
||||||
published
|
published
|
||||||
Property DataSource : TDataSource read FDataSource write FDataSource;
|
Property DataSource : TDataSource read FDataSource write FDataSource;
|
||||||
|
property OnChangeCS: TCSAjaxEvent read FOnChangeCS write FOnChangeCS;
|
||||||
|
property OnChange: THandleAjaxEvent read FOnChange write FOnChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ THTMLDatasetContentProducer }
|
{ THTMLDatasetContentProducer }
|
||||||
@ -420,6 +426,9 @@ type
|
|||||||
|
|
||||||
const SimpleOkButton: array[0..0] of TWebButton = ((buttontype: btok;caption: 'Ok';onclick: ''));
|
const SimpleOkButton: array[0..0] of TWebButton = ((buttontype: btok;caption: 'Ok';onclick: ''));
|
||||||
|
|
||||||
|
const jseButtonClick = 1000;
|
||||||
|
jseInputChange = 1001;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
Uses
|
Uses
|
||||||
{$ifdef cgidebug}
|
{$ifdef cgidebug}
|
||||||
@ -814,6 +823,7 @@ begin
|
|||||||
if not opened then
|
if not opened then
|
||||||
close;
|
close;
|
||||||
end;
|
end;
|
||||||
|
SetupEvents(Result);
|
||||||
finally
|
finally
|
||||||
WriteFooter (aWriter);
|
WriteFooter (aWriter);
|
||||||
end;
|
end;
|
||||||
@ -838,6 +848,20 @@ begin
|
|||||||
FOnWriteRecord (self, aWriter);
|
FOnWriteRecord (self, aWriter);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function THTMLCustomDatasetContentProducer.GetEvents: TEventRecords;
|
||||||
|
begin
|
||||||
|
AddEvent(result,jseInputChange,OnChange,'onchange',OnChangeCS);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure THTMLCustomDatasetContentProducer.HandleAjaxRequest(ARequest: TRequest;
|
||||||
|
AnAjaxResponse: TAjaxResponse);
|
||||||
|
begin
|
||||||
|
inherited HandleAjaxRequest(ARequest, AnAjaxResponse);
|
||||||
|
case StrToIntDef(ARequest.QueryFields.Values['event'],-1) of
|
||||||
|
jseInputChange : if assigned(OnChange) then OnChange(Self, ARequest, AnAjaxResponse);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ THTMLSelectProducer }
|
{ THTMLSelectProducer }
|
||||||
|
|
||||||
procedure THTMLSelectProducer.SetItems(const AValue: TStrings);
|
procedure THTMLSelectProducer.SetItems(const AValue: TStrings);
|
||||||
|
Loading…
Reference in New Issue
Block a user