I can think about a workaround or tool to retrieve the internal index of the combo item. But can you tell me the logic of your app related to these cells? I think there should be a special processing of new entered strings that are not on the list: you need to add them to the db from code, retrieve their IDs, add them to the combo list attached to the cell, etc.
I'm an Ms Access developer for years now.
Maybe my problem is how much easy is in Access to handle combo boxes. 🙂
In the other hand Igrid can to much more than Access continues forms. That is why I am trying to replace some of them to add functionality and avoid the
much hated flickering.
In Access, Combo boxes combine both worlds of your two kinds of combo boxes. (igCellCombo and igCellTextCombo).
There is a “LimitToList” property that defines if the user can or cannot type text other than the listed values.
There is also a “NotInList” event that is triggered every time the user types something out of the listed values.
If, in the event code, you add the value to the database (and tell Access that you did it) , Access requeries the combo box list and places the new value in the correct order. (e.g. alphabetical order).
In both cases, there is a bound column to the combo box that can be different from the displayed column. (as in igCellCombo).
Let’s have an example :
Let’s say that you have a table with towns and their unique ids and you must be able to add new ones.
To accomplish this in Igrid one must use igCellTextCombo and…:
• Open Recordset as above and populate the values one by one through looping in it. ( a “FillFromRS” procedure for comboboxes would be nice and faster (I suppose))
• When a user selects a listed town, to store the ID in the database, developer must do a binary recursive search in Combo Box items (or loop) to find the corresponding Index of the displayed text, so that you can retrieve the ItemValue and store it.
• When user enters a new town, developer must do again a binary recursive search in Combo Box items to find if the town is listed. If not, new Town must be added to the database and repopulate the combo box to include the new value or must find by code the proper index to insert it.
To accomplish this in Igrid if listindex property was existed:
• Open Recordset as above and populate the values one by one through looping in it.
• When user selects a listed town, store ItemValue(ListIndex) to the database
• When user enters a new town, (listindex should be zero or -1 if zerobased), add town to the database and repopulate the combo box to include the new value or find by code the proper index to insert it.
This is a much more clean approach, which eliminates errors in the process and most of all is very mach faster if we consider comboboxes with many items.
That is, again, if I'm not missing something...
Edited by user
2016-04-26T14:50:28Z
|
Reason: Not specified