Set autocomplete keyboard type?

android

#1

Hi,
Any one know how to achieve this?

    <au:RadAutoCompleteTextView items="{{ allTruckCodes }}" 
                                    width="70%" 
                                    suggestMode="Suggest" 
                                    displayMode="Tokens" 
                                    completionMode="StartsWith" 
                                    id="runsList"
                                    textChanged="{{ onTextChanged }}"
                                    tokenAdded="{{ onTokenAdded}}" 
                                    tokenRemoved="{{ onTokenRemoved }}"
                                    tokenSelected= "{{ onTokenSelected }}" 
                                    tokenDeselected= "{{ onTokenDeselected }}"
                                    **keyboardType="number"**>
          <au:RadAutoCompleteTextView.suggestionView>
            <au:SuggestionView suggestionViewHeight="300">
              <au:SuggestionView.suggestionItemTemplate>
                <Label text="{{ text }}" fontSize="24" padding="15"/>
              </au:SuggestionView.suggestionItemTemplate>
            </au:SuggestionView>
          </au:RadAutoCompleteTextView.suggestionView>
        </au:RadAutoCompleteTextView>

#2

There is no direct api exposed, but you can do something like this in the loaded event of auto complete text field.

export function onLoaded(args) {
    args.object.nativeView.getTextField().setInputType(android.text.InputType.TYPE_CLASS_PHONE);
}

Note: As this is Android specific, make sure you don’t run this set of lines in iOS.


#3

Hi @manojdcoder, thanks for your reply.

I tried your method and it gives me args.object.nativeView.getTextField() is not a function.

Something similar happened when I run

autocomp = <RadAutoCompleteTextView>page.getViewById("runsList");
autocomp.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);

#4

I did test the code with playground already, if you are facing issue please try to create a playground example and share so I can take a look.


#5

Thanks the hint from @manojdcoder.

Here is the solution

let autocomp = <RadAutoCompleteTextView>page.getViewById("runsList");
autocomp.android.getTextField().setInputType(android.text.InputType.TYPE_CLASS_NUMBER);