I'm trying to create a badge on a slide out navigation item, but I can't seem to make it work.
Basically I have a Login that can create Hour Registrations. These registrations needs to be either confirmed or denied by a Login with Role_ID = 1.
After a Login has logged in (if Role_ID = 1), I pull out all of these Hour Registrations from my service, and then does this:
if (data.Role.Id === 1) {
HourRegistrationApplication.config.navigation[7].visible(true);
$.getJSON(baseAddress + "hours/head/" + data.Id,
function (hourRegArray) {
if (hourRegArray.length != 0) {
console.log(hourRegArray.length);
HourRegistrationApplication.app.navigation[7].option("badge", hourRegArray.length);
}
});
}
Where hourRegArray is the JSON that I return:
[
{
"ID": 1,
"Hours": 5,
"Date": "27/08/2015",
"Comment": "Stackoverflow rocks",
"Login_ID": 1
},
{
"ID": 2,
"Hours": 3,
"Date": "25/08/2015",
"Comment": "Stackoverflow rocks even more!",
"Login_ID": 1
}
]
Then I wish to have the value of badge to be the hourRegArray.length, but for some strange reason I get this error:
0x800a138f - JavaScript runtime error: Invalid operand to 'in': Object expected
What exactly is causing the problem here?
I've made a support ticket on the DevExtreme support forum, and the support told me to update my project to the latest 15.1.6 (I think it is now), didn't make any difference, I get the same error.