Your search did not match any results.
Scheduler

SignalR Service

This demo shows how two users can edit data in the Scheduler simultaneously. A SignalR service is used to broadcast push notifications.

Each Scheduler has an individual store to emulate the situation when Schedulers are being edited on two different clients. Changes made in one Scheduler are repeated in the other and persist until the browser session has expired.

Copy to CodePen
Apply
Reset
$(function() { var BASE_PATH = "/Demos/Mvc/"; var url = BASE_PATH + "api/SchedulerSignalR"; var createScheduler = function(index) { $("#scheduler" + index).dxScheduler({ dataSource: DevExpress.data.AspNet.createStore({ key: "AppointmentId", loadUrl: url + "/Get", insertUrl: url + "/Post", updateUrl: url + "/Put", deleteUrl: url + "/Delete", onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }), remoteFiltering: true, views: ["day", "workWeek"], currentView: "day", currentDate: new Date(2017, 4, 23), startDayHour: 9, endDayHour: 19, height: 600, textExpr: "Text", startDateExpr: "StartDate", endDateExpr: "EndDate", allDayExpr: "AllDay" }); }; createScheduler(1); createScheduler(2); $.connection.hub.url = BASE_PATH + "signalr"; var hub = $.connection.schedulerSignalRHub; var store1 = $("#scheduler1").dxScheduler("getDataSource").store(); var store2 = $("#scheduler2").dxScheduler("getDataSource").store(); hub.client.update = function (key, data) { store1.push([{ type: "update", key: key, data: data }]); store2.push([{ type: "update", key: key, data: data }]); }; hub.client.insert = function (data) { store1.push([{ type: "insert", data: data }]); store2.push([{ type: "insert", data: data }]); }; hub.client.remove = function (key) { store1.push([{ type: "remove", key: key }]); store2.push([{ type: "remove", key: key }]); }; $.connection.hub.start({ waitForPageLoad: false }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <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="js/signalr/jquery.signalR-2.2.2.js"></script> <script src="js/signalr/signalr-hub.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/18.2.3/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/18.2.3/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/18.2.3/js/dx.all.js"></script> <script src="https://unpkg.com/devextreme-aspnet-data@2.0.0"></script> <script src="index.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div class="schedulers"> <div class="column-1"> <div id="scheduler1"></div> </div> <div class="column-2"> <div id="scheduler2"></div> </div> </div> </div> </body> </html>
.schedulers { display: flex; } .column-1 { padding-right: 5px; } .column-2 { padding-left: 5px; } .dx-scheduler-small .dx-scheduler-view-switcher.dx-tabs { display: table; }