ComboBoxes

I am confused by a way an incremental search is working in comboboxes which have optionDataSource set to an XML file or data returned form Server.
There are two ways of using comboboxes: dynamic form and ListGrid.

  1. Dynamic form.
    When I type into a combo its data gets filtered on a characters being entered. Take a look at http://www.smartclient.com/#listComboBox into a combo on the right. Type word “glue” into it. The drop down portion will also have “Tape Dispenser Atg-100 Glue”. Which means that a filter searches for any character that matches typed characters at ANY position. Not really an incremental search which would have been from the left to right.
  2. ListGrid
    In order to work around a problem in #1 I have created ListGrid class that mimics DF field: ListGrid has one column and one row and it looks just like a DF’s combobox. The good news is that an incremental search in this case works correctly: it checks characters from left to right.

I dont know what has happened, but now my ListGrids work just like DFs.
The incremental search does not work from left to right instead filter is checking for a character at any position.

Could you please explain how to get a true incremental search working?

Thanks

Hi Mark,
The fundamental issue here is that at this time databound comboboxes perform a standard “substring” type filter against the server, so the drop-down list will display all records that contain the entered string, not just those that start with it.
However, if you have a combobox with an explicit valueMap , the drop-down will contain only options that start with the current value of the combo-box text field (which is the behavior you want - “incremental search”)

Therefore the best way for you to get this behavior is to apply an explicit valueMap to your field.
If you need to get these options from the server, you can perform a one-time DataSource.fetchData() call to retrieve the complete set of options from the server, and create a static valueMap object from that. The ‘setData()’ documentation demonstrates how to do exactly this.

Thanks
Isomorphic Software

Do you mean “setValueMap (valueMap)” on a form’s item?

Hi Mark
Yes - once you have the valueMap object, you can apply it to an existing ComboBoxItem via the setValueMap() method.
Having set the valueMap to the full set of options, when the user types, the options displayed in the drop down list will be only those that start with the same letters the user has entered into the text box.

BTW, I have just tested it (again) in 5.6 and incremental search works correctly for a combobox in a ListGrid. So, my model works.
Is it possible to have what’s used to work in 5.6 to work in 5.7.1? If not, please show me how to create a ValueMap object.

Thanks

The docs for fetchData have an inline example of how a valueMap can be created from server-side data loaded on the fly.

Yes, got it, working just as I wanted. Thanks!
The only thing it is badly effected by a problem I have described in my other thead.