Hi, first of all , i not too sure how to put my questions across , but my objective is that
i wish to know which list item is making a call/or trigger an onclick event,
i want the TwebListControl ,where EACH ITEM to have it's own customized onItemClick
(i know the default TWebListControl , is made for this purpose and i found it has no
issues but somehow , after i added some <div> and it's classes ,the click event in web document
is overwritten & it just won't fire the event . However, i confirmed that the onITemClick event works, when i try to keep my list item (item.text ) simple. It will not work if my item.text has other 'DIV' which
has special class . i.e. special Bootstrap class etc )
So i decided to make my own custom call in delphi . i have added some code in
onGetItemChildren event for the TwebListControl . so in my procedure , it looks like this ,
i have also declared my show_detail_view procedure as follow ,procedure Tfmproduct.product_webcontrol_listGetItemChildren(Sender: TObject;AItem: TListItem; AElement: TJSHTMLElement);beginAElement.setAttribute('id', IntToStr(AItem.Tag) );AElement.addEventListener('click', @show_detail_view );end;
procedure show_detail_view( AElement: string ); i have defined the parameter passed is as
string type and can found that , when the procedure is been triggered, the parameter
is MouseEvent object.
As the click event is added using AElement.addEventListener , so at the point of adding the
delphi procedure as above ,AElement.addEventListener .
i wish to detect which AElement , the <li> that i customize and add items into the
list control using delphi code is makjing the call ,so after created the list,
each item , i.e. <li id="1"> has it's own unique id.
(Q) Now how can i detect which item with it's id is trigger and fire the event show_detail_view
which is been declared as procedure show_detail_view( AElement: string );
(Q) is my parameter AElement type correct or what is the correct type ?
thanks.