I am building a web application which makes use of kendo UI and angular-kendo. The problem that I'm having is that the change event handlers, when specified in code, are never fired.
Example:
Whenever this is loaded at initial load of the application, the change event will fire. If it gets loaded in a controller at a later time (think switching routes in ngRouter, or states in angular-ui-router), the change event will not get fired.
If I specify the k-on-change directive, like this:
the specified change handler will fire, no matter when the HTML gets loaded.
The problem isn't just with the datasource.change event either. The kendoPager.chancge event didn't work either when in code.
What does angular-kendo do differently at initial page load than at a partial view load that would cause that problem? Is there a way to work around it? (Aside from specifying k-on-change)
Example:
01.
$scope.gridData =
new
kendo.data.DataSource({
02.
data: [{
"Id"
: 1 }, {
"Id"
: 2 }],
03.
change:
function
(event) {
04.
// TODO: Save sort to localstorage.
05.
console.log(
"CHANGE FIRE"
);
06.
07.
var
sort = $scope.gridSort =
this
.sort();
//contactsGrid.dataSource.sort();
08.
09.
var
sortString = getSortString(sort);
10.
11.
if
(sortString != lastSortString) {
12.
var
sortCopy = angular.copy(sort);
13.
14.
contactsService.get((gridPager.page() - 1) * gridPager.pageSize(), gridPager.pageSize(), sortString).then(parseContacts);
15.
16.
lastSortString = sortString;
17.
}
18.
}
19.
});
Whenever this is loaded at initial load of the application, the change event will fire. If it gets loaded in a controller at a later time (think switching routes in ngRouter, or states in angular-ui-router), the change event will not get fired.
If I specify the k-on-change directive, like this:
<
div
kendo-pager
k-options
=
"pagerOptions"
k-on-change
=
"pagerChange()"
id
=
"gridPager"
></
div
>
The problem isn't just with the datasource.change event either. The kendoPager.chancge event didn't work either when in code.
What does angular-kendo do differently at initial page load than at a partial view load that would cause that problem? Is there a way to work around it? (Aside from specifying k-on-change)