Your search did not match any results.
Scheduler

SignalR Service

This demo shows how you can use a SignalR service to synchronize appointments across different devices. To emulate such a setup, each Scheduler on this page reads data from its own separate data store. Changes made in one control are repeated in the other and persist until the browser session has expired.

Follow the steps below to implement this functionality. Note again that this demo repeats all steps twice for the two Schedulers. Your project will have a single control and a single store.

  1. Configure a CustomStore. In this demo, we use the createStore method (part of the DevExtreme.AspNet.data extension).

  2. Create the Scheduler and use its dataSource property to bind it to the store instance.

  3. When a push notification is received, call the store's push(changes) method to update the store's data (see the connection.on event handlers).

For server-side configuration, refer to the ASP.NET MVC version of this demo.

For more information about integration with push services, refer to the following help topic: Integration with Push Services.

Copy to CodePen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); var BASE_PATH = "https://js.devexpress.com/Demos/NetCore/"; DemoApp.controller('DemoController', function DemoController($scope) { var store1 = createStore(), store2 = createStore(); $scope.scheduler1Options = createOptions(store1); $scope.scheduler2Options = createOptions(store2); var connection = new signalR.HubConnectionBuilder() .withUrl(BASE_PATH + "schedulerSignalRHub", { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets }) .configureLogging(signalR.LogLevel.Information) .build(); connection.start() .then(function () { connection.on("update", function (key, data) { store1.push([{ type: "update", key: key, data: data }]); store2.push([{ type: "update", key: key, data: data }]); }); connection.on("insert", function (data) { store1.push([{ type: "insert", data: data }]); store2.push([{ type: "insert", data: data }]); }); connection.on("remove", function (key) { store1.push([{ type: "remove", key: key }]); store2.push([{ type: "remove", key: key }]); }); }); }); var createStore = function() { var url = BASE_PATH + "api/SchedulerSignalR"; return DevExpress.data.AspNet.createStore({ key: "AppointmentId", loadUrl: url, insertUrl: url, updateUrl: url, deleteUrl: url, onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }) }; var createOptions = function(store) { return { dataSource: store, timeZone: "America/Los_Angeles", remoteFiltering: true, views: ["day", "workWeek"], currentView: "day", currentDate: new Date(2021, 3, 27), startDayHour: 9, endDayHour: 19, height: 600, dateSerializationFormat: "yyyy-MM-ddTHH:mm:ssZ", textExpr: "Text", descriptionExpr: "Description", startDateExpr: "StartDate", endDateExpr: "EndDate", allDayExpr: "AllDay" }; };
<!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.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.1.4/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.1.4/css/dx.light.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/21.1.4/js/dx.all.js"></script> <script src="https://unpkg.com/devextreme-aspnet-data@2.8.2/js/dx.aspnet.data.js"></script> <script src="js/signalr.js"></script> <script src="../signalr-session-id.js"></script> <script src="index.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div class="schedulers"> <div class="column-1"> <div dx-scheduler="scheduler1Options" id="scheduler1"></div> </div> <div class="column-2"> <div dx-scheduler="scheduler2Options" 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; }