igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Add [paginatorTemplate] parameter to IgxGrid and IgxTreeGrid

Open luiscla27 opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Currently, I have to duplicate the <igx-paginator> code every time I want to implement an IgxGrid or IgxTreeGrid

Describe the solution you'd like

I would like to be able to reuse the same <igx-paginator> on all my IgxGrid/IgxTreeGrid implementations, in my case I think the most natural way is to keep the Angular content or inline template, the following example would be ideal:

<ng-template #paginator> 
         <igx-paginator *ngIf="paging">
                  <igx-paginator-content>
                           ...
                  </igx-paginator-content>
         </igx-paginator>
</ng-template>
<igx-grid  #grid1 ... [paginatorTemplate]="paginator"> ... columns and more </igx-grid>
<igx-grid  #grid2 ... [paginatorTemplate]="paginator"> ... other columns and more </igx-grid>

Describe alternatives you've considered

The only alternative I currently have seems to duplicate my code, an alternative expected result for this FR could be to print the template directly and receive additional parameters using a directive:

<ng-template #paginator> 
         <igx-paginator *ngIf="paging">
                  <igx-paginator-content>
                           ...
                  </igx-paginator-content>
         </igx-paginator>
</ng-template>
<igx-grid  #grid1 ...> 
        <ng-container igxPaginator [ngTemplateOutlet]="paginator"></ng-container>
         ... columns and more
</igx-grid>
<igx-grid  #grid2 ...>
        <ng-container igxPaginator [ngTemplateOutlet]="paginator"></ng-container>
         ... columns and a lot more
</igx-grid>

Additional context

Breaking changes or new features might need to be replicated in a lot of places, this FR might solve version upgrade issues

luiscla27 avatar Nov 12 '21 21:11 luiscla27

I just wanted to let you know that I managed to partially solve this by using an <ng-container> inside <igx-paginator-content>, I still have to duplicate the paginator attributes, the only workaround for that issue seems to set every attribute using setters

luiscla27 avatar Nov 22 '21 20:11 luiscla27

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Jan 22 '22 00:01 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Sep 14 '22 00:09 github-actions[bot]