Hello. I'm trying to use "No records found" example (from here) but popup with no-data-found-msg is closing each second time.
Where is the problem in my code?
$scope.AutoCompleteOptions = {
dataTextField:
"No"
,
filter:
"contains"
,
minLength: 1,
ignoreCase:
true
,
highlightFirst:
true
,
headerTemplate:
'<span id="no-data-found-msg"><b>Бюллетень не найден</b></span>'
,
dataBound:
function
() {
var
noItems =
this
.list.find(
"#no-data-found-msg"
);
debugger;
if
(!
this
.dataSource.view()[0]) {
noItems.show();
this
.popup.open();
}
else
{
noItems.hide();
}
},
dataSource: {
type:
"odata"
,
serverFiltering:
true
,
transport: {
read: {
url: getBulletinsUrl,
dataType:
"json"
,
method:
"GET"
},
parameterMap:
function
(data, type) {
return
{
filter: $scope.editingGroup.BulletinNo
};
}
},
schema: {
data:
function
(data) {
return
data;
},
total:
function
(data) {
return
data[
'odata.count'
];
},
model: {
id:
"ID"
,
fields: {
ID: {
editable:
false
,
nullable:
true
},
No: {
type:
"string"
}
}
}
}
},
select:
function
(e) {
var
dataItem =
this
.dataItem(e.item.index());
$scope.editingGroup.BulletinId = dataItem.ID;
},
change:
function
() {
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] === value) {
found =
true
;
break
;
}
}
if
(!found) {
this
.value(
""
);
}
}
};