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
1415
Update the child grid everytime we expand the row in Igx Hierarchal Grid
posted

Hi Team,

I am using Hierarichal grid load on demand feature of V9.1.28.

Requirement: Everytime i expand the child grid, i want to get the updated Data binded to the child grid.Also only one grid is expanded at a time. I also expand a row on page load.

One more thing if the event.expanded is true, why the code is called so many times? it should be called once, right?

Using rowToggle(event) to achieve the same.

Also i want copy the child grid data to excel. i am using [clipboardOptions]="options" property to copy and paste the data to excel in 

<igx-row-island> but it is not copying and pasting the data.
 public options = {
    enabled: true,
    copyHeaders: false,
    copyFormatters: true,
    separator: '\t'
  };

TS:

 public rowToggle(evt) {
    // triggered when we collapse the row
    if(!evt.expanded){
 
      this.grid1.expandRow( evt.rowID);  //than expand the row that event was trigged
      this.getChildData( evt.rowID);  // API is called to get the Child data
      } else {
     
      if(this.rowExpandID !== evt.rowID) {
        evt.cancel = true;
        this.rowExpandID = evt.rowID;
        setTimeout(() => {
          //first collapsed all other expanded rows
          this.grid1.collapseAll();     // for some reason this is not getting triggered.
      }, 30);
      setTimeout(() => {
        this.grid1.expandRow(evt.rowID)
        this.getChildData( evt.rowID); 
    }, 90);
   
      }
     
    }

Not sure why the code is not working. I just want to expand a row and see the latest child data everytime.