Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148725 | Oct 31,2019 08:17 PM UTC | Nov 4,2019 10:09 AM UTC | JavaScript - EJ 2 | 3 |
![]() |
Tags: MultiSelect |
[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, |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.