Trying to submit an autocomplete search box with the text that's typed into the box. I can use onValueChanged
but it fires every keypress. I need to search when enter is pressed. I've tried a few things but can't work it out. This is part of a dxToolbar:
{
location: 'after',
widget: 'dxAutocomplete',
options: {
width: '340px',
placeholder: 'Enter title, category or identifier',
dataSource: PageAutoCompleteDataSource($http),
bindingOptions: {
searchText: 'text'
},
onChange: function(e){
console.log('Value searched ' + $scope.searchText);
DevExpress.ui.notify("Searching for " + $scope.searchText);
}
}
}
Never mind about the datasource etc. I just need to know how to get the current value in any of the onXX events?
It looks like you are looking for the onEnterKey event handler:
$scope.autocompleteOptions = {
//...
onEnterKey: function(e) {
var selectedValue = e.component.option("value");
DevExpress.ui.notify("Searching for " + selectedValue);
}
};