Hello, I read all the threads for the Grid component and I couldn't find anything about what I'm trying to achieve.
Could you please provide a working example? if feasible.
I would like to have a Grid using detailTemplate.
Inside the ng-template create another Grid, that doesn't need to share the data binding of the container Grid, its DataSource can be loaded from another place like a plain object, or remote source.
Using as start point the example from the following documentation, the StackBlitz example:
https://ej2.syncfusion.com/angular/demos/#/bootstrap5/grid/detail-template
What I found Is that, for some reason, if the inner grid has not the same number of columns as the container Grid, when you expand it, is like takes place over the container one, but this doesn't happen when the columns number is the same.
Could you try to reproduce this? Is it feasible to do? Maybe I am doing something wrong. Help appreciated.
Thanks,
Ernesto
Hi Rajapandi,
I already saw that demo, it's the one I used to test the scenario I brought up.
Here is a template modified version that you can use to reproduce the issue:
As you can see, I just added a grid inside the ng-template container, if you try this as it is, it will work, if you remove any or all the "Remove and test" columns it will break when you expand details on the main grid.
This should be enough for you to understand the problem. The inner grid, uses a different datasource, reference, and id just for sample purpose.
Thank you for your help,
Ernesto
|
<ejs-grid #grid1 [dataSource]='data' id='Grid'>
<e-columns>
<e-column field='EmployeeID' headerText='Employee ID' width='125' textAlign='Right'></e-column>
<e-column field='FirstName' headerText='Name' width='120'></e-column>
<e-column field='Title' headerText='Title' width='170'></e-column>
<e-column field='HireDate' headerText='Hire Date' width='135' textAlign='Right' format='yMd'></e-column>
<e-column field='ReportsTo' headerText='Reports To' width='120' textAlign='Right'></e-column>
</e-columns>
<ng-template #detailTemplate>
<ejs-grid #grid2 [dataSource]='data2'>
<e-columns>
<e-column
field="custom"
headerText="Single"
></e-column>
<e-column
field="custom"
headerText="Remove and test"
></e-column>
<e-column
field="custom"
headerText="Remove and test"
></e-column>
<e-column
field="custom"
headerText="Remove and test"
></e-column>
<e-column
field="custom"
headerText="Remove and test"
></e-column>
</e-columns>
</ejs-grid>
</ng-template>
</ejs-grid>
|
Thank you Rajapandi,
with that change it's working as expected.
I would suggest you to change the demo page to reflect that and stress out that specific order to avoid this strange behavior on row expand.
Regards,
Ernesto