Skip to content

Instantly share code, notes, and snippets.

@windwp
Created January 22, 2016 09:14
Show Gist options
  • Save windwp/637de41ae4028398796e to your computer and use it in GitHub Desktop.
Save windwp/637de41ae4028398796e to your computer and use it in GitHub Desktop.
kendo ui
// kendo autocomplete and delete for not select item
$("#kendoList").kendoAutoComplete({
dataTextField: "ten",
dataSource: dataSource,
placeholder: 'aaa',
filter: "contains",
select(e) {
var item=e.item.index();
},
change() {
var found = false;
var value = this.value();
var data = this.dataSource.view();
for (var idx = 0, length = data.length; idx < length; idx++) {
if (data[idx][this.options.dataTextField] === value) {
found = true;
break;
}
}
if (!found) {
this.value("");
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment