TListItem Attribute disappears


I have a TWebListControl.
When I create a TListItem, I set the HTML value using
MyItem.ListElement.setAttribute( 'value', 'myString');
It is working.
If I add the next TListItem, the value attribute from the previous entry disappears.

Did I do something wrong? I don't know where to look.


It is because when you add items, the component re-renders the list in the DOM.

I need to save some data to a ListItem.
Either a TObject, TJSObject or a string in which I store JSON.
Is there a possibility?
This would be much easier than if I had to maintain a separate list in which I store the objects.

I found the property "Data" in Core Source\WEBLib.Lists and transferred it to Component Library Source\WEBLib.Lists.

Will this have side effects?
If not, can you include this in the next release?

I cannot see side effects but you could also already use ListItem.Tag to hold a reference to extra information you need.

Well, I already use the property tag and since I need a string, Data is the better and, above all, easier way.
Maybe it can be made public in the next release.

Thank you

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

We will add it as public property.

1 Like