Hello David!
Maybe I have found a little bug. It seems like that the itemIndex property of the select input control does not change or does get at false value -1 after selecting. Setting the property works.
Best regards, Mario
Hello David!
Maybe I have found a little bug. It seems like that the itemIndex property of the select input control does not change or does get at false value -1 after selecting. Setting the property works.
Best regards, Mario
Hello Mario,
Are we talking about AB1, don't you? If so... I can't reproduce here the problem... Please, be sure that you are using "[Select1.ItemIndex]" and not "[Select1.itemIndex]": note that the "ItemIndex" is case sensitive, so we can't use "itemIndex".
If we are talking about AB2, then certainly the property's name is "itemIndex", but, I can't reproduce the problem. If I place the below code in the Change event of a Select control, what I get is the expected item index:
Hi!
I Think it's AB2 2022.3 the newest version of App Builder. (but was the same in older versions)
Is it possible that this value is only in the change event available?
and for context: the select control is on a Dialog View. I want to read the itemIndex of the select control on clicking on a button on this Dialog view.
And there is the value -1 after a change.
Hello Mario,
First of all, we can set the "itemIndex" property of a Select control at designtime. That "itemIndex" is therefore the set one before the Select control "changes". Once you change the selected item, certainly the "Change" event is fired, but, even if you did not use that event, the "itemIndex" property changes accordingly to the new selected item.
I can't reproduce the problem, Mario. I place a Select control in a dialog, then I place a button in the dialog and when press the button, show the "itemIndex" of the Select control in an alert. It's work as expected. If I did not select any new item at runtime, then the designtime set is what I see in the alert. If I change the selected item at runtime, then what I get is the corresponding "itemIndex".
May you can provide to me a sample app in which you can reproduce the problem? Please, feel free to send me the app via Email, so I can take a look. Please, use one or more Comment controls or include some kind of "ReadMe.txt" file in order to tell me what you expected and what you get. Maybe the problem exists and therefore I can do something about, but, trying here what I understand that I must try, I simply can't reproduce the problem.
Hello to all,
I post here this because may can be useful for other customers. Finally Mario and me discover (after some mails interchange and tests) that the problem is caused due to feed the "items" of the Select control with numbers and not strings. Apparently in this case the "itemIndex" property is certainly set to "-1" and not contain the expected value, that is, the index of the selected item. The solution, for now, is to feed the Select control's items property with strings and not with numbers. Doing that the "itemIndex" always returns the correct index of the selected item in the Select control.
If what we certainly have is an Array of numbers, we can use the "map" function to feed the Select items property with strings instead of numbers: just take a look at the below code:
By doing that the "itemIndex" property work as expected, since what we really assign to the items property is an array of strings and not an array of numbers.
Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.
Este sitio utiliza "cookies" útiles para almacenar sus preferencias.