I'm using the TWebLookUpComboBox object in my project. I load its content in a procedure where I receive the response from an API and build the pairs using JSON, and this works perfectly. My issue arises when I try, in another procedure, to change the value of this combobox so that the display is altered, but the element doesn't change at all.
I created a test case with 2 buttons and 3 boxes where:
Button 1, when clicked, loads the pairs into the first box's items and successfully sets the value to 5. Button 2, when clicked, sets the value to 1 with three different results:
In the first result: Box 1, where the ElementeID is linked to the HTML, is only updated using a JavaScript function to force the update.
In the second result: Box 2, where ElementeID is NOT linked, is updated correctly without using an extra function.
In the third result: Box 3, where ElementeID is linked to the HTML, is NOT updated as expected when using box3.value := '1'.
$('.select2bs4').select2({
theme: 'bootstrap4',
placeholder: "Selecione uma opção",
});
and this transforms the HTML SELECT elements into a combination of <UL> and <LI> elements.
When TWebLookupComboBox is linked to a HTML element, it expects a SELECT element with elements, so this JavaScript code you added breaks the linking between TWebLookupComboBox and the SELECT element in the template.
I am attaching an example in Visual Studio Code of using Select2 in conjunction with WebCombobox, I believe it may help others who have the same question. Thanks. TMSWEBCORE_SELECT2.zip (851.7 KB)