Hello, I know this might be simple for others, but please I could not get it to work.
I am trying both combo and choice boxes but I could not make it work as I want. I the query result in variable rs (contains id and name), I can place the rs as list items either the id or the name but not both. I want to place the id and name in the combobox or choicebox so that when the selected index change is triggered, I can store the record's real id instead of the combobox or choicebox's id. I am trying to make additional methods to handle finding the record again when retrieving form it's table.
basically i want the combobox or choicebox to use the record's real id instead of the combobox or choicebox's id.
This is a question we all ask ourselves when coming to B4X with combos, especially waiting for a .net SelectedValue that doesn't exist. There are some alternatives to the standard ComboBox, you should use
At the request of my friend @Mashiane , I created a combobox that has the graphics of my IconTextView that is Multiplatform (B4X, B4J, B4i) NOTE: You can use this library for personal and commercial use. Include it in your projects.. Attention, even if it is a B4XLib library, it is not allowed...
www.b4x.com
The development is by @Star-Dust, he is a trusted member in the operation of his libraries.
2. The DIY option: while populating the combobox/choicebox items with the text values, also populate a list with the ID values. When a text is clicked, use its index to fetch the appropriate ID from the list.
I now see the problem using this, https://www.b4x.com/android/forum/threads/b4x-lmb4xcombobox.116767/#post-729765. When retrieving the record for viewwing and rendering the value from the database to the element. it uses the the customview's selected index which is different from the record id so you will be rendering the incorrect value in the combo box. I could not figure out how to display the correct record id in the custom combobox as of now.