Created
January 22, 2016 09:14
-
-
Save windwp/637de41ae4028398796e to your computer and use it in GitHub Desktop.
kendo ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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