Ng-template with kendo datepicker with different attributes

0 Answers 6 Views
DatePicker General Discussions
Marek
Top achievements
Rank 1
Marek asked on 24 Nov 2022, 12:49 PM

I have two templates but I need optimize it to one template, the only different of that templates is that one kendo datepicker has more viewing atributes. Is there any way to get one template and for example for one button the kendo datepiker has some atributes and for another clicking button the datepiker has different atributes and everything is on one template? With two templates everything is working fine.

 

 

 


<ul class="list-group">
    <li class="list-group-item flex-fill border-0">  
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportDaily(itemListRef, 'pdf')">PDF</button>
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportDaily(itemListRef, 'csv')">CSV</button>          
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportDaily(itemListRef, 'xlsx')">XLSX</button>
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportDaily(itemListRef, 'txt')">TXT</button>   
    </li>
</ul>

<ul class="list-group">
    <li class="list-group-item flex-fill border-0">
       
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportMonthly(itemListRef1, 'pdf')">PDF</button>
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportMonthly(itemListRef1, 'csv')">CSV</button>
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportMonthly(itemListRef1, 'xlsx')">XLSX</button>
        <button type="button" class="btn btn-link btn-sm" (click)="generateReportMonthly(itemListRef1, 'txt')">TXT</button>
    </li>
</ul>

<ng-template #itemListRef kendoCalendarMonthCellTemplate let-context="cellContext">
    <form>
        
        <div>
            <kendo-datepicker
            [(ngModel)]="reportStartEnd"
            [ngModelOptions]="{standalone: true}">
            </kendo-datepicker>
        </div>
     
        <div>
            <kendo-datepicker
            [(ngModel)]="reportEndDate"
            [ngModelOptions]="{standalone: true}"> 
            </kendo-datepicker> 
        </div>
    </form>
</ng-template>

<ng-template #itemListRef1 kendoCalendarMonthCellTemplate let-context="cellContext">
    <form>
        
        <div>
            <kendo-datepicker
            [(ngModel)]="reportStartDate"
            [ngModelOptions]="{standalone: true}"
            bottomView="year"
            topView="decade"
            format="MMMM yyyy"
            >
            </kendo-datepicker>
        </div>
       
        <div>
            <kendo-datepicker
            [(ngModel)]="reportEndDate"
            [ngModelOptions]="{standalone: true}"
            bottomView="year"
            topView="decade"
            format="MMMM yyyy">
            </kendo-datepicker>
        </div>
    </form>
</ng-template>
Marek
Top achievements
Rank 1
commented on 28 Nov 2022, 09:13 AM

Resolved

No answers yet. Maybe you can help?

Tags
DatePicker General Discussions
Asked by
Marek
Top achievements
Rank 1
Share this question
or