Just change the xtype to 'tagfield'
xtype: 'tagfield'
This allows you to select multiple inputs.
The below code is how I'm using the tagfield in a View
{
fieldLabel: 'Customers',
name: 'customerIds',
xtype: 'tagfield',
queryMode: 'remote',
valueField: 'Id',
displayField: 'FirstName',
forceSelection: true,
allowBlank: false,
store: {
type: 'customers'
},
minChars: 1,
triggerAction: 'all',
typeAhead: true
}
This code also allows you to search and also for auto-completion.
Find my full View here
Ext.define('MyApp.view.CustomersSelectView', {
extend: 'Ext.form.Panel',
xtype: 'customersSelectView',
title: 'Select some Customers',
store: { type: 'someStore' },
bodyPadding: 10,
url: 'some url',
method: 'POST',
defaultType: 'textfield',
modal: true,
items: [{
fieldLabel: 'Customers',
name: 'customerIds',
xtype: 'tagfield',
queryMode: 'remote',
valueField: 'Id',
displayField: 'FirstName',
forceSelection: true,
allowBlank: false,
store: {
type: 'customers'
},
minChars: 1,
triggerAction: 'all',
typeAhead: true
}],
jsonSubmit: true,
buttons: [{
text: 'Send',
formBind: true,
diabled: true,
handler: function () {
var form = this.up('form');
if (form.isValid()) {
form.submit({
success: function (form, action) {
Ext.toast('Customers selected successfully');
form.reset();
},
failure: function (form, action) {
Ext.Msg.alert('Failure', 'Oops, something went wrong!');
}
});
}
}
}]});
Happy coding!