Hi
I'm facing a difficulty to create a TWebButton inside a HTML template code for a TListItem
I'm using event for TWebListControl
GetItemChildren(Sender: TObject; AItem: TListItem; AElement: TJSHTMLElementRecord);
But there isn't parent control provided here so the create button isn't replacing the elementid from html code and is created in the closest parent I found = TWebListControl
But in this case the place of button is wrong (but working)
procedure TFormView_Carto.List_ResultsGetItemChildren(Sender: TObject;
AItem: TListItem; AElement: TJSHTMLElementRecord);
var
ButtonGoDepot : TWebButton;
ButtonGoItiner : TWebButton;
ButtonGoIti_Name : String;
procedure ButtonDepotClick(Sender: TObject);
begin
DM_Main.WebDebuglog('Module API >> ButtonDepotClick');
DM_Main.WebDebuglog('Tag = '+IntToStr((Sender as TWebButton).tag));
DM_Main.WebDebuglog('Module API << ButtonDepotClick');
end;
begin
if (AItem.Tag<>0) then
Begin
ButtonGoIti_Name := StringReplace('button_go_{{POI_ID}}','{{POI_ID}}',IntToStr(AItem.Tag),[rfReplaceAll,rfIgnoreCase]);
ButtonGoItiner := TWebButton.Create(List_Results);
ButtonGoItiner.Caption := 'ITI '+IntToStr(AItem.Tag);
ButtonGoItiner.Cursor := crHandPoint;
ButtonGoItiner.OnClick := @ButtonDepotClick;
ButtonGoItiner.ElementClassName := 'button-outline button-itinerary';
ButtonGoItiner.ElementID := ButtonGoIti_Name;
ButtonGoItiner.Parent := List_Results;
ButtonGoItiner.ElementPosition := epIgnore;
ButtonGoItiner.WidthStyle := TSizeStyle.ssAuto;
ButtonGoItiner.HeightStyle := TSizeStyle.ssAuto;
ButtonGoItiner.Tag := AItem.Tag;
End;
end;
Is there a way to work with TWebListControl or do I need to change of component ?
Thanks
Sylvain