Autocomplete data source a table vs a list

Hi @adhamfaisal

When you click the clone link, you get two apps:

  1. The Search Hints app itself
  2. The example app that uses it (‘Search Hints Example’)

Search Hints Example is where the results list is set up. The get_search_keys method of the SearchHintsDemo form is what returns the results list.

Currently it is:

  def get_search_keys(self, **event_args):
    """Get the search keys from the Data Table."""
    return anvil.server.call('get_search_keys')

You need to change it to:

  def get_search_keys(self, **event_args):
    """Get the search keys from the Data Table."""
    hints = ["cat", "dog", "mouse"]
    return [{'entry': h} for h in hints]

The anvil.server.call('get_search_keys') returns something that behaves like a list of dictionaries, i.e.:

[
  {"entry": "cat"},
  {"entry": "dog"},
  {"entry": "mouse"},
]

So if you want to replace it with your own entries, you need to construct an object that looks like that.

1 Like