[Tree grid] Column Chooser position bug with multiple tree grids

Hi,


When having multiple treegrids on the same page and each have a column chooser, only the first treegrid of the page can open the column chooser.

Here is a sample that reproduce the issue : https://stackblitz.com/edit/angular-uw8e8g?file=component2.component.ts

You will see that component1(red), component2(blue) and component3(yellow) each contains the same code with services from ColumnChooserService being provided for each component but when you try to open the column chooser from component3(yellow) it opens the one from component1.

Same happens for component2(blue).

When you change the columns however it works well with the column being applied to the correct treegrid.


Kind regards,

Théo Armengou


3 Replies 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team July 6, 2022 03:00 PM UTC

Hi Théo Armengou,


Query#:- Column Chooser position bug with multiple tree grids


Further analyzing the reported problem occurs when multiple Column Chooser’s has been rendered with same ID. This is because, multiple TreeGrid’s has the same ID since you have not differentiate with id property.


To overcome this problem we suggest to define different Id’s for TreeGrid so that columnchooser will be rendered with that different id.

Modified sample link:- https://stackblitz.com/edit/angular-uw8e8g-t66fze?file=app.component.html


Refer to Code below:-

Component1.component.html

<ejs-treegrid

    id="treegrid"

    #treegrid

    [dataSource]="data"

    allowPaging="true"

    childMapping="subtasks"

    height="350"

    [treeColumnIndex]="1"

    [showColumnChooser]="true"

    [toolbar]="toolbar"

    [pageSettings]="pageSettings"

  >

   </ejs-treegrid>

 

Component2.component.html

<ejs-treegrid

    id="treegrid1"

    #treegrid

    [dataSource]="data"

    allowPaging="true"

    childMapping="subtasks"

    height="350"

    [treeColumnIndex]="1"

    [showColumnChooser]="true"

    [toolbar]="toolbar"

    [pageSettings]="pageSettings"

  >

   </ejs-treegrid>

 


Screenshot:-


Please get back to us if you need any further assistance.


Regards,

Farveen sulthana T


Marked as answer

UN Unknown July 26, 2022 09:11 AM UTC

Hi,


Your solution worked perfectly.


Thanks a lot :D


Regards,

Théo Armengou



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team July 27, 2022 12:24 PM UTC

Hi Theo,


Thanks for your update. Please get back to us if you need any further assistance. We are happy to assist you further.


Regards,

Farveen sulthana T


Loader.
Up arrow icon