1

How do I access weekday from inside the dxTemplate below?

<dxi-column *ngFor="let weekday of calendarWeek" alignment="center" caption="{{weekday.Day}}">
    <dxi-column alignment="center" caption="{{weekday.Date}}">
        <dxi-column caption="7 8 9 10 11 12 1 2 3 4 5 6 7" [width]="182" cellTemplate="chartCellTemplate"></dxi-column>
    </dxi-column>
</dxi-column>  

so weekday above needs to be accessed in the below to compare against schedule

<div *dxTemplate="let instructor of 'chartCellTemplate'">
    <div class="chart-cell">
        <table>
            <tr>
                <td style="padding:0px; border:0; margin: 0px;">
                    <div *ngFor="let schedule of instructor.data.ScheduleDisplay" [ngStyle]="{'background-color': schedule.activityColor, 'color': schedule.activityColor, width:schedule.activityLength, padding:'0px', border:'0px', margin:'0px', display:'inline-block'}">{{weekday.data.Date}}</div>
                </td>                
            </tr>                    
        </table>               
    </div>
</div>

https://stackblitz.com/edit/angular-devextreme-sandbox-eycsyy

4

1 回答 1

0

根据cellTemplate API 参考,data参数包含有关行数据的信息。所以你需要使用instructor.data而不是weekday.data定义。

于 2019-11-27T18:57:23.783 回答