typedInput and autoComplete

Hi all,

I have some question regarding the autoComplete with a typedInput:

  1. I wonder what is the correct way to attach autoComplete to a typedInput? Currently I have only found that $(this).parent().find('.red-ui-typedInput-input') might be the way to go.

  2. When I want to disable autoComplete for a particular type of the typedInput I don't know how to do it. Can someone give a hint?

Hi @ptweety

You can set an autoComplete option on individual types.

For example, here you can see how we add autocomplete for the built in msg type:

Thank you, @knolleary

So I wrote something like this, which seems to work:

$(this).typedInput({
  types: [
    {
      value: 'str',
      label: 'string',
      icon: 'red/images/typedInput/az.svg',
      autoComplete: function () {
        return [
          { value: 'aa', label: 'AA' },
          { value: 'bb', label: 'BB' },
        ];
      },
    },
    { value: 're', label: 'regular expression', icon: 'red/images/typedInput/re.svg' },
  ],
});

Is there a better approach where I do not need to repeat value, label, icon of the default types?

No - we hadn't considered providing a more convenient way to add custom autoCompletes to the existing 'str' option, rather than for an entirely custom type.

What you have is the right way to do it.