Repository navigation
Expand file tree
/
Copy pathdata-binding.js
More file actions
55 lines (52 loc) · 2.42 KB
/
Copy pathdata-binding.js
File metadata and controls
55 lines (52 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
this.default = function () {
// initialize AutoComplete component
var atcObj1 = new ej.dropdowns.AutoComplete({
// bind the DataManager instance to dataSource property
dataSource: new ej.data.DataManager({ url: 'https://ej2services.syncfusion.com/production/web-services/api/Employees', adaptor: new ej.data.WebApiAdaptor(), crossDomain: true}),
// set the count for displays the suggestion items.
suggestionCount: 5,
// bind the Query instance to query property
query: new ej.data.Query().select(['FirstName', 'EmployeeID']).take(10).requiresCount(),
// map the appropriate columns to fields property
fields: { value: 'FirstName' },
// set the placeholder to AutoComplete input element
placeholder: 'e.g. Andrew Fuller',
// sort the resulted items
sortOrder: 'Ascending',
// enable the autofill property to fill a first matched value in input when press a down key
autofill: true,
// set the filterType to searching operation
filterType: 'StartsWith',
});
atcObj1.appendTo('#products');
// initialize AutoComplete component
var atcObj2 = new ej.dropdowns.AutoComplete({
//set the local data to dataSource property
dataSource: window.ddCountryData,
// map the appropriate columns to fields property
fields: { value: 'Name' },
// set the placeholder to AutoComplete input element
placeholder: 'e.g. Australia',
// sort the resulted items
sortOrder: 'Ascending',
// set the filterType to searching operation
filterType: 'StartsWith',
// enable the autofill property to fill a first matched value in input when press a down key
autofill: true
});
atcObj2.appendTo('#country');
var checkBoxObj = new ej.buttons.CheckBox({
// set true for enable the checked state at initial rendering
checked: true,
// set text value for check box element.
label: 'Autofill',
// bind change event
change: function (args) {
// enable or disable the autofill in remote data AutoComplete based on CheckBox checked state
atcObj1.autofill = args.checked;
// enable or disable the autofill in local data AutoComplete based on CheckBox checked state
atcObj2.autofill = args.checked;
}
});
checkBoxObj.appendTo('#checkAutofill');
};