search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

autoRefresh setup for AngularJS

Asked by dodegaard
8 years ago.

I have a scheduler that is setup via a $scope.config in an Angular directive. Works great but trying to enable autoRefresh per instructions and it is not working. I have the following code in this partial dump of a $scope.config. Can you help me discover how to make this work? I was not able to find a demo of autoRefresh for Angular so feel free to send url if there is one. My goal is to reload every 30 seconds to poll for changes from other users. If you have any recommendations on push as well let me know. Much appreciated. Thanks.

$scope.config = {
useEventBoxes: "Never",
snapToGrid: false,
allowEventOverlap: false,
onBeforeCellRender: function(args) {
if (args.cell.start.getDayOfWeek() === 5 || args.cell.start.getDayOfWeek() === 6) {
args.cell.backColor = "#f9f9f9"; //highlights Friday and Saturday as weekends
} else if (args.cell.start.getDayOfWeek() === 0) {
args.cell.backColor = "#ffffff"; // overrides default highlighting of Sunday
}
},
cssOnly: true,
scale: "CellDuration",
days: $scope.days,
width: "100%",
heightSpec: "Max",
height: $scope.windowHeight,
cellWidthSpec: "Auto",
cellDuration: 720, //720 for a half day, 1400 for a whole day
headerHeight: 40,
eventHeight: 35,
autoRefreshInterval: 10,
autoRefreshMaxCount: 10,
autoRefreshEnabled: true,
onAutoRefresh: function(args) {
alert("refreshing, " + args.i);
},

Answer posted by Dan Letecky [DayPilot]
8 years ago.

Your configuration is fine - there was a problem in DayPilot. In Angular, the Scheduler initialization mechanism is slightly different and the autorefresh didn't start automatically.

It's fixed now in the latest sandbox build (8.1.1955):

http://javascript.daypilot.org/sandbox/

Comment posted by dodegaard
8 years ago.

Thanks Dan. I pulled the daypilot.all.min.js fil and all seems to initialize the refresh properly. Two important questions:

1) I am now showing "Demo" again. Since I have a paid license how can I get the licensed copy of the sandbox script?
2) I am firing the same code that populates it with events originally. My refresh code is called but the visual elements in the scheduler do not update. Do I need to initialize anything to have events move from one cell to another since backend data changes and resulting events do as well? Wondering if onAutoRefresh() needs more to actually update the cells.

Thanks.
Doug

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.