Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,35 @@ describe('snapToCellsMode', () => {
expect(appH).toEqual(DEFAULT_CELL_HEIGHT);
});

it('changing snapToCellsMode at runtime regenerates appointment view model', async () => {
const { POM, scheduler } = await createScheduler({
width: 800,
height: 600,
views: ['day'],
currentView: 'day',
currentDate: new Date(2026, 2, 15),
cellDuration: 30,
startDayHour: 9,
endDayHour: 18,
dataSource: [{
text: 'short',
startDate: new Date(2026, 2, 15, 10, 0),
endDate: new Date(2026, 2, 15, 10, 10),
}],
});

let appH = POM.getAppointment('short').getGeometry().height;

expect(appH).toBeLessThan(DEFAULT_CELL_HEIGHT / 2);

scheduler.option('snapToCellsMode', 'always');
await new Promise(process.nextTick);

appH = POM.getAppointment('short').getGeometry().height;

expect(appH).toEqual(DEFAULT_CELL_HEIGHT);
});

it('views[].snapToCellsMode always overrides default on day view', async () => {
const { POM } = await createScheduler({
width: 800,
Expand Down
6 changes: 6 additions & 0 deletions packages/devextreme/js/__internal/scheduler/m_scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,12 @@ class Scheduler extends SchedulerOptionsBaseWidget {
this._appointments.option('items', this._layoutManager.generateViewModel());
}
break;
case 'snapToCellsMode':
this._appointments.option('items', []);
if (this.readyToRenderAppointments) {
this._appointments.option('items', this._layoutManager.generateViewModel());
}
break;
case 'tabIndex':
case 'focusStateEnabled':
this.updateOption('header', name, value);
Expand Down
Loading