0

I need a dropdown next to a column header. I'm doing that by adding an appropriated HTML in columns' name:

Column definition: {name: "<span>My Column</span> <select><option>A</option><option>B</option></select>",...}

This works fine. However, when the grid rerenders the headers the dropdown is reset to the default value.

Is there a callback I can use to set the wanted value (the new HTML with the last selected option)?

Can I prevent the headers from being rerender?

Thanks in advance.

Ken White
  • 123,280
  • 14
  • 225
  • 444
joelpenov
  • 1
  • 1
  • 1

1 Answers1

0

Well, if someone else is facing the same issue, I was able to fix it using this method:

On

angularGridReady

 this.angularGrid.gridStateService.onGridStateChanged.subscribe(()=>{
      this.columnDefinitions.find(x=> x.id === "MyColumnId").name = 
      this.getDropdownHtml();
      this.columnDefinitions = this.columnDefinitions.slice();
    });

this.getDropdownHtml(); is a method that returns the dropdown (HTML code) with the last selected value selected.

joelpenov
  • 1
  • 1
  • 1