Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
igHierarchicalGrid in igniteUI
posted

I am using igHierarchicalGrid for our angular2 component. I have two question

 

  • How can we change the sub-table header according to data in parent table at runtime. i.e one sub-table have deferent Header  than another sub-table
  • Can please provide me a documentation for handling events in angular2 ? As I am not able to figure out handling events on github in angular2. 

Parents
No Data
Reply
  • 18204
    Offline posted

    Hello Ankur Shah,

    Thank you for posting in our forums!

    To answer your first question, you can change the child grid's options during the childGridRendered event.  You can get the record for the parent with the event arguments and the findRecordByKey method.

    I have attached a sample at the bottom of this post that demonstrates how to achieve this and the relevant code snippet below:

    childGridRenderedHandler(event: any) {
        const ui = event.ui;
        //  Get the parent row's data.
        const parentRecord = $(ui.owner.element).igGrid("findRecordByKey", ui.parentrow.data("id"));
        //  Set the child grid's header.
        $(ui.childgrid.element).igGrid("option", "caption", parentRecord.FirstName + " " + parentRecord.LastName);
    }

    To run the sample you will need npm installed.  First, extract the files to a folder and open a CLI in the folder.  Then type "npm install" and then "npm start".

    For your second question, the Angular2 website has some information on binding to events in their documentation here.

    If you would like to see some specific IgniteUI documentation or an example of using events, please feel free to submit an issue for it on github.

    If you have any further questions or concerns with this, please let me know and I will be glad to help.

    igniteui-angular2.zip
Children