Child component in Angular failing to trigger change event in list

In my current project, I have a parent component responsible for making an AJAX call to fetch data from the backend to populate a grid. To render the grid data, I created a child component where I pass the list as an in-binding. However, I noticed that whenever I update the list in the parent component, the child component fails to trigger the onchange event. Below is a snippet of my code. Additionally, both the parent and child components are nested under another component that uses a Kendo tabstrip.

Parent Component:

<div layout="column">
    <md-content>
        <div layout="row">
            <member-mvlicense-grid member-id="vm.memberId"></member-mvlicense-grid>
        </div>
    </md-content>
</div>

Child Component:

<md-content>
    <div kendo-grid="vm.grid" options="vm.gridOption" ng-style="{'height':vm.gridHeight}"
         k-on-change="vm.handleChange(data, dataItem, columns)"></div>
</md-content>

Parent onchange Event:

public $onChanges(onChangesObj: angular.IOnChangesObject): void {
            //this.dataList = new Array<model.member.IMembersMVLicensesResult>();
            if (this.memberId && this.memberId.toString().toLowerCase() != "add") {


this.membersMVLicensesService.getByMemberId(this.memberId).then((response) => {
                this.timeString = new Date().getTime().toString();
                let someValue = response;
                this.dataList = someValue;
                console.log(this.dataList);
            }, (error) => {

            });
        }
    }

Answer №1

When using the Kendo Grid, it's important to note that the change event may not trigger when the grid is populated with data ("on list").

This event is fired when a user selects a table row or cell within the grid.

Learn more about this event here

The dataBound event on the Grid itself triggers when the grid is populated. However, there doesn't seem to be a built-in Angular binding for this event. I've tried k-on-dataBound and k-on-databound without success.

To work around this, you can bind the dataSource event in your gridOption implementation like so:

$scope.gridOption = {
      ...
      dataBound: function() {
        // Implement your handleChange logic here
      },

Edit: I have discovered the correct binding for this event, which is

k-on-data-bound

You can try using this instead of k-on-change as mentioned before.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Mastering the art of horizontal scrolling within an angular material layout=row

I am attempting to create a slider using only a horizontal scrollbar with cards inside. In order to do this, I am trying to scroll the layout="row" within an ng-repeat. Check out my codepen here <body ng-app="myApp" ng-cloak ng-controller="ProductCont ...

Implementing dynamic AngularJS functionality within an older HTML structure using JQuery

I am facing an issue while trying to load dynamic content using AngularJS. In my system, I have legacy pages that utilize JQuery for dynamic loading. However, as I am developing new features with AngularJS, I am encountering the same problem with dynamic ...

Encountering unforeseen challenges when implementing Angular routing alongside NGINX routing

I have developed an Angular single page application that utilizes HTML routing and ng-route. This means that all the pages can be accessed through links such as: example.com/products example.com/home However, I also have a blog section on my website whic ...

Can you explain the significance of the output "Object[...]" displayed in Firebug?

Currently, I am logging an object within an AngularJS directive. Specifically, I am focusing on the parameters of the link() function of the directive. Here is the code snippet: link: function(scope, element, attrs) { console.log(attrs) } Upon checking ...

The debugger successfully displayed the HTML page in the POST response, but it was not visible in the browser when

Having an issue with my connection form that is sending a Post request to a servlet. The servlet then forwards the request to different pages after performing some tests such as password and email verification of the user. However, the problem I am facing ...

Is there a way to adjust the height of the pull-up footer in Ionic?

This particular example demonstrates the use of ion-pullup.js, although it seems to be functioning correctly. However, there is an issue where the pull-up footer covers the entire window. I am looking for a way to adjust the pull-up footer so that it only ...

Learning how to parse Json to a controller object for Kendo UI grid server filtering

I've encountered an issue with filtering the Kendo UI grid server-side. When I check the developer tools, I see the following query string: /Home/GetUsmMessage?{"filter":{"logic":"and","filters":[{"field":"MessageId","operator":"eq","value":1}]},"gro ...

How can you simulate an error response with $httpBackend in Angular?

I am currently running tests to ensure that my program handles HTTP request error messages correctly. However, I am facing a challenge trying to simulate this scenario using $httpBackend. The code snippet I have is: $httpBackend.expectGET(path).respond(40 ...

What is the purpose of ng-submit blocking the default action?

According to the ng-book: The ng-submit directive is used to connect an expression to an onsubmit event. It also stops the default action (sending the request and refreshing the page), unless the form includes an action attribute. Can you explain the sig ...

Which one should I utilize for a single-page application with login separation: $stateProvider or $routeProvider?

I am trying to build a single page app with login separation, meaning that certain views can only be accessed by authenticated users. My initial code looks like this: .config(function ($routeProvider) { $routeProvider .when('/', { ...

Issues with AngularJS dirty validation for radio buttons not being resolved

I have encountered an issue with my form fields. The validation for the email field is working correctly, but the radio button field is not displaying any errors when it should. I am using angular-1.0.8.min.js and I cannot figure out why this is happenin ...

What is the alternative to $templateCache in Angular2 and how can CachedResourceLoader be utilized in its place?

While I have come across 2 similar questions on Stack Overflow and here, none of them seem to provide a solution. After delving into the Angular repository, I stumbled upon this issue where they inquire about an alternative for templateCache in Angular 2, ...

Exploring Angular unit testing using Jasmine: Techniques to customize or delete spyOn

Current software versions for AngularJS and Jasmine: AngularJS v1.2.26 Jasmine v2.2.0 I am facing an issue with a spyOn. When attempting to change or remove its behavior, I encounter the following error message: Error: getUpdate has already been spied u ...

Transferring URL from web.config to an AngularJS .html view

In my current project, I am working on an application that utilizes Asp.net MVC along with Angularjs. One challenge I encountered is how to pass a URL, which is stored as a key in the web.config file, to a link within an Angularjs .html view. For example, ...

Error in Angular multiselect dropdown: Unable to retrieve the length of undefined property

counter: number = 0; getDatatypes(){ if(this.counter == 0) { if(this.appId != 0) { if(undefined != this.datatypes && this.datatypes.length) for (let i = 0; i < this.datatypes.length; i++) { this.ap ...

Integrating external JavaScript libraries into Ionic using the correct process

For the last few months, I have been utilizing jQuery Mobile for a hybrid app. Now, I am interested in exploring Ionic and Angular.js, so I am attempting to reconstruct it. My current JQM application relies on xml2json.js, but I do not have any experience ...

Icons from Material Design Lite are not appearing as expected when integrated into an Angular project

Recently, I integrated MDL into my Angular project. While most of it is functioning properly, the MDL icons seem to be giving me trouble... I've implemented them using <i class="material-icons">share</i>, but instead of displaying as an i ...

The AngularJS 1.5 component modal with a callback function is experiencing issues with updating Angular bindings when called multiple times by an embedded object in IE11

Encountering an issue in IE 11 with an Angularjs 1.5 modal component where the binding is not updating as expected when multiple callbacks are made from an embedded object call. The console messages show that the callbacks are being executed, but the templ ...

The syntax of AngularJS directives

Apologies for my lack of experience with this question :) I am working on displaying a progress bar in AngularJS using UI Bootstrap. The directive works perfectly when the value is hardcoded: <progress percent="67"></progress> However, I en ...

The syntax for an Angular controller

During my research on angular interview questions and answers, I came across a discussion about different syntax styles for controllers. The author presented their code in the following format: function Customer($scope) { $scope.CustomerName = "Sh ...