[search string length]
// initialize the MultiSelect component
let listObj: MultiSelect = new MultiSelect({
// set placeholder to MultiSelect input element
placeholder: 'Select countries',
// set the countries data to dataSource property
dataSource: (data as any).countries,
// bind the Query instance to query property
query: new Query(),
// map the appropriate columns to fields property
fields: { text: 'Name', value: 'Code' },
// set true for enable the filtering support.
allowFiltering: true,
// bind the filtering event
filtering: (e: FilteringEventArgs) => {
e.preventDefaultAction = true;
let query: Query = new Query();
// frame the query based on search string length with filter type.
query = (e.text.length > 3) ? query.where('Name', 'startswith', e.text, true) : query;
// pass the filter data source, filter query to updateData method.
e.updateData((data as any).countries, query);
}
});
listObj.appendTo('#list');
[timeout]
// initialize the MultiSelect component
let listObj: MultiSelect = new MultiSelect({
// set placeholder to MultiSelect input element
placeholder: 'Select countries',
// set the countries data to dataSource property
dataSource: (data as any).countries,
// bind the Query instance to query property
query: new Query(),
// map the appropriate columns to fields property
fields: { text: 'Name', value: 'Code' },
// set true for enable the filtering support.
allowFiltering: true,
// bind the filtering event
filtering: (e: FilteringEventArgs) => {
e.preventDefaultAction = true;
let query: Query = new Query();
// frame the query based on search string with setTimeOut filter type.
query = (e.text !== "") ? query.where('Name', 'startswith', e.text, true) : query;
// pass the filter data source, filter query to updateData method.
setTimeout(function () {
e.updateData((data as any).countries, query);
}, 1000)
}
});
listObj.appendTo('#list');
|
focus: function(args) {
console.log(this.value)
}
|
openOnClick: false, |