Hello,
I tried creating list badges like explained here : https://www.tmssoftware.com/site/blog.asp?post=473 but they never appear.
with this simplified code (i really simplified it to this) :
for i := 0 to aList.Length-1 do
begin
li := WbLstControl.Items.Add;
li.ItemClassName := 'list-group-item list-group-item-info';
li.Text := string(JS.TJSObject(aList)['Name']);
with TWebBadge.Create(WbLstControl) do
begin
ElementClassName:= 'badge badge-info';
Text := JS.toString(i);
ParentElement := TJSHTMLElement(li.ListElement);
end;
end;
begin
li := WbLstControl.Items.Add;
li.ItemClassName := 'list-group-item list-group-item-info';
li.Text := string(JS.TJSObject(aList)['Name']);
with TWebBadge.Create(WbLstControl) do
begin
ElementClassName:= 'badge badge-info';
Text := JS.toString(i);
ParentElement := TJSHTMLElement(li.ListElement);
end;
end;
Of course, i tried TWebBadge.Create with None, Self, list item li, the TWebListControl instance...
List items are created, badges are created but with no text and are never attached to the dom.
The badged code section is compiled to this :
The badged code section is compiled to this :
var $with3 = pas["WEBLib.ExtCtrls"].TBadge.$create("Create$1",[$Self.WbLstControl]);
$with3.SetElementClassName("badge badge-info");
$with3.SetText(pas.JS.ToString(I));
$with3.SetParentElement(li.FListElement);
$with3.SetElementClassName("badge badge-info");
$with3.SetText(pas.JS.ToString(I));
$with3.SetParentElement(li.FListElement);
of course at first i tried with
aBadge := TWebBadge.Create(WbLstControl);
aBadge.ElementClassName:= 'badge badge-info';
aBadge.Text := JS.toString(i);
aBadge.ParentElement := TJSHTMLElement(li.ListElement);
aBadge.ElementClassName:= 'badge badge-info';
aBadge.Text := JS.toString(i);
aBadge.ParentElement := TJSHTMLElement(li.ListElement);