Your search did not match any results.
Scheduler

Limit the Appointment Count per Cell

Documentation

This example demonstrates how to limit the number of full-sized appointments per cell. On exceeding the limit, appointments are sent to the appointment collector where they are customized using the ** appointmentTooltipTemplate** template.

Copy to CodeSandBox
Apply
Reset
<template> <div> <dx-scheduler :data-source="dataSource" :current-date="currentDate" :height="650" :on-content-ready="onContentReady" :on-appointment-deleted="onAppointmentDeleted" appointment-tooltip-template="AppointmentTemplateSlot" current-view="month" > <dx-resource :data-source="resourcesData" field-expr="roomId" label="Room" /> <dx-view type="month" name="Auto Mode" max-appointments-per-cell="auto" /> <dx-view type="month" name="Unlimited Mode" max-appointments-per-cell="unlimited" /> <dx-view :max-appointments-per-cell="2" type="month" name="Numeric Mode" /> <appointment-template slot="AppointmentTemplateSlot" slot-scope="{ data }" :scheduler="scheduler" :data="data" /> </dx-scheduler> </div> </template> <script> import DxScheduler, { DxResource, DxView } from 'devextreme-vue/scheduler'; import AppointmentTemplate from './AppointmentTemplate.vue'; import { resourcesData, data } from './data.js'; export default { components: { DxScheduler, DxResource, DxView, AppointmentTemplate }, data() { return { scheduler: null, currentDate: new Date(2017, 4, 25), dataSource: data, resourcesData: resourcesData, }; }, methods: { onContentReady(e) { this.scheduler = e.component; }, onAppointmentDeleted() { this.scheduler.hideAppointmentTooltip(); } }, }; </script>
<template> <div> <div class="appointment-content"> <div :v-if="data.roomId" :style="styleObject" class="appointment-badge" > {{ data.text[0] }} </div> <div class="appointment-text">{{ data.text }}</div> <div class="appointment-dates"> {{ Globalize.formatDate(data.startDate, { skeleton: 'MMMd' }) }}, {{ Globalize.formatDate(data.startDate, { time: 'short' }) }} - {{ Globalize.formatDate(data.endDate, { time: 'short' }) }} </div> <dx-button :on-click="deleteAppointment" class="delete-appointment" icon="trash" /> </div> </div> </template> <script> import 'devextreme/localization/globalize/date'; import Globalize from 'globalize'; import DxButton from 'devextreme-vue/button'; import Query from 'devextreme/data/query'; import { resourcesData } from './data.js'; const dayOfWeekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; const getAppointmentColor = function(resourceId) { return Query(resourcesData) .filter('id', resourceId) .toArray()[0].color; }; export default { components: { DxButton }, props: { scheduler: { type: Object, default: () => { } }, data: { type: Object, default: () => { } } }, data() { return { dayOfWeekNames: dayOfWeekNames, Globalize: Globalize, styleObject: { backgroundColor: getAppointmentColor(this.data.roomId) } }; }, mounted() { Globalize.locale('en'); }, methods: { deleteAppointment() { this.scheduler.deleteAppointment(this.data); } } }; </script> <style scoped> .appointment-content { width: 360px; } .dx-popup-content .appointment-content { height: 40px; line-height: 20px; } .appointment-badge { text-align: center; float: left; margin-right: 12px; color: white; width: 28px; height: 28px; font-size: 20px; line-height: 28px; border-radius: 28px; margin-top: 5px; display: flex; justify-content: center; flex-direction: column; padding-bottom: 2px; } .appointment-dates { color: #959595; font-size: 12px; text-align: left; float: left; } .appointment-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 270px; font-size: 15px; text-align: left; float: left; } .delete-appointment { position: relative; border: none; box-shadow: none; height: 40px; } .delete-appointment .dx-button-content { width: 40px; height: 40px; } .delete-appointment.dx-state-hover, .dx-list-item.dx-state-hover .dx-button { box-shadow: none; background-color: inherit; } .delete-appointment .dx-icon-trash { color: #337ab7 !important; font-size: 23px !important; } </style>
import Vue from 'vue'; import App from './App.vue'; new Vue({ el: '#app', components: { App }, template: '<App/>' });
<!DOCTYPE html> <html> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/event.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/supplemental.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/unresolved.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/message.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/number.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/currency.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/date.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.3/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/19.1.3/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> <span v-if="false">Loading...</span> </div> </div> </body> </html>
export const data = [ { text: 'Google AdWords Strategy', roomId: 1, startDate: new Date(2017, 4, 5, 9, 0), endDate: new Date(2017, 4, 5, 10, 30) }, { text: 'New Brochures', roomId: 5, startDate: new Date(2017, 4, 5, 11, 30), endDate: new Date(2017, 4, 5, 14, 15) }, { text: 'Brochure Design Review', roomId: 5, startDate: new Date(2017, 4, 5, 13, 15), endDate: new Date(2017, 4, 5, 16, 15) }, { text: 'Website Re-Design Plan', roomId: 5, startDate: new Date(2017, 4, 5, 16, 45), endDate: new Date(2017, 4, 5, 11, 15) }, { text: 'Rollout of New Website and Marketing Brochures', roomId: 2, startDate: new Date(2017, 4, 9, 8, 15), endDate: new Date(2017, 4, 9, 10, 45) }, { text: 'Update Sales Strategy Documents', roomId: 3, startDate: new Date(2017, 4, 9, 12, 0), endDate: new Date(2017, 4, 9, 13, 45) }, { text: 'Non-Compete Agreements', roomId: 3, startDate: new Date(2017, 4, 9, 8, 15), endDate: new Date(2017, 4, 9, 9, 0) }, { text: 'Update NDA Agreement', roomId: 1, startDate: new Date(2017, 4, 10, 11, 45), endDate: new Date(2017, 4, 10, 13, 45) }, { text: 'Update Employee Files with New NDA', roomId: 4, startDate: new Date(2017, 4, 18, 14, 0), endDate: new Date(2017, 4, 18, 16, 45) }, { text: 'Submit Questions Regarding New NDA', roomId: 4, startDate: new Date(2017, 4, 18, 8, 0), endDate: new Date(2017, 4, 18, 9, 30) }, { text: 'Submit Signed NDA', roomId: 4, startDate: new Date(2017, 4, 18, 12, 45), endDate: new Date(2017, 4, 18, 14, 0) }, { text: 'Review Revenue Projections', roomId: 4, startDate: new Date(2017, 4, 25, 17, 15), endDate: new Date(2017, 4, 25, 18, 0) }, { text: 'Comment on Revenue Projections', roomId: 1, startDate: new Date(2017, 4, 22, 9, 15), endDate: new Date(2017, 4, 22, 11, 15) }, { text: 'Provide New Health Insurance Docs', roomId: 4, startDate: new Date(2017, 4, 22, 12, 45), endDate: new Date(2017, 4, 22, 14, 15) }, { text: 'Review Changes to Health Insurance Coverage', roomId: 4, startDate: new Date(2017, 4, 25, 14, 15), endDate: new Date(2017, 4, 25, 15, 30) }, { text: 'Review Training Course for any Ommissions', roomId: 4, startDate: new Date(2017, 4, 22, 14, 0), endDate: new Date(2017, 4, 22, 12, 0) }, { text: 'Recall Rebate Form', roomId: 2, startDate: new Date(2017, 4, 23, 12, 45), endDate: new Date(2017, 4, 23, 13, 15) }, { text: 'Create Report on Customer Feedback', roomId: 3, startDate: new Date(2017, 4, 23, 15, 15), endDate: new Date(2017, 4, 23, 17, 30) }, { text: 'Review Customer Feedback Report', roomId: 3, startDate: new Date(2017, 4, 17, 16, 15), endDate: new Date(2017, 4, 17, 18, 30) }, { text: 'Customer Feedback Report Analysis', roomId: 3, startDate: new Date(2017, 4, 17, 9, 30), endDate: new Date(2017, 4, 17, 10, 30) }, { text: 'Prepare Shipping Cost Analysis Report', roomId: 3, startDate: new Date(2017, 4, 23, 12, 30), endDate: new Date(2017, 4, 23, 13, 30) }, { text: 'Provide Feedback on Shippers', roomId: 3, startDate: new Date(2017, 4, 23, 14, 15), endDate: new Date(2017, 4, 23, 16, 0) }, { text: 'Select Preferred Shipper', roomId: 1, startDate: new Date(2017, 4, 26, 17, 30), endDate: new Date(2017, 4, 26, 20, 0) }, { text: 'Complete Shipper Selection Form', roomId: 5, startDate: new Date(2017, 4, 25, 8, 30), endDate: new Date(2017, 4, 25, 10, 0) }, { text: 'Upgrade Server Hardware', roomId: 5, startDate: new Date(2017, 4, 26, 12, 0), endDate: new Date(2017, 4, 26, 14, 15) }, { text: 'Upgrade Personal Computers', roomId: 5, startDate: new Date(2017, 4, 26, 14, 45), endDate: new Date(2017, 4, 26, 16, 30) } ]; export const resourcesData = [ { text: 'Room 401', id: 1, color: '#bbd806' }, { text: 'Room 402', id: 2, color: '#f34c8a' }, { text: 'Room 403', id: 3, color: '#ae7fcc' }, { text: 'Room 407', id: 4, color: '#ff8817' }, { text: 'Room 409', id: 5, color: '#03bb92' } ];
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, map: { vue: 'npm:vue@2.5.16/dist/vue.esm.browser.js', 'vue-loader': 'npm:systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.1', 'devextreme-vue': 'npm:devextreme-vue@19.1', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.6/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js', 'globalize': 'npm:globalize/dist/globalize', 'cldr': 'npm:cldrjs/dist/cldr', 'cldr-data': 'js/cldr', 'json': 'npm:systemjs-plugin-json/json.js' }, meta: { '*.vue': { loader: 'vue-loader' } }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' }, 'globalize': { main: '../globalize.js', defaultExtension: 'js' }, 'cldr': { main: '../cldr.js', defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });