浏览代码

fix ordering of current date constraining and toolbar updating. fixes #3651

Adam Shaw 8 年之前
父节点
当前提交
0727a1e271
共有 4 个文件被更改,包括 11 次插入10 次删除
  1. 7 0
      src/Calendar.js
  2. 1 1
      src/Calendar.render.js
  3. 3 0
      src/common/View.date-range.js
  4. 0 9
      src/common/View.js

+ 7 - 0
src/Calendar.js

@@ -143,6 +143,13 @@ var Calendar = FC.Calendar = Class.extend(EmitterMixin, {
 	},
 
 
+	reportViewDatesChanged: function(view, dateProfile) {
+		this.currentDate = dateProfile.date; // might have been constrained by view dates
+		this.setToolbarsTitle(view.title);
+		this.updateToolbarButtons();
+	},
+
+
 	prev: function() {
 		var prevInfo = this.view.buildPrevDateProfile(this.currentDate);
 

+ 1 - 1
src/Calendar.render.js

@@ -164,7 +164,7 @@ Calendar.mixin({
 			}
 
 			if (this.elementVisible()) {
-				this.currentDate = this.view.setDate(this.currentDate);
+				this.view.setDate(this.currentDate);
 			}
 		}
 

+ 3 - 0
src/common/View.date-range.js

@@ -55,6 +55,9 @@ View.mixin({
 		this.end = calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, this.isRangeAllDay);
 		this.intervalStart = calendar.msToMoment(dateProfile.currentUnzonedRange.startMs, this.isRangeAllDay);
 		this.intervalEnd = calendar.msToMoment(dateProfile.currentUnzonedRange.endMs, this.isRangeAllDay);
+
+		this.title = this.computeTitle();
+		this.calendar.reportViewDatesChanged(this, dateProfile);
 	},
 
 

+ 0 - 9
src/common/View.js

@@ -122,13 +122,6 @@ var View = FC.View = ChronoComponent.extend({
 	------------------------------------------------------------------------------------------------------------------*/
 
 
-	// Sets the view's title property to the most updated computed value
-	updateTitle: function() {
-		this.title = this.computeTitle();
-		this.calendar.setToolbarsTitle(this.title);
-	},
-
-
 	// Computes what the title at the top of the calendar should be for this view
 	computeTitle: function() {
 		var unzonedRange;
@@ -311,8 +304,6 @@ var View = FC.View = ChronoComponent.extend({
 	executeDateRender: function(dateProfile, skipScroll) {
 
 		this.setDateProfileForRendering(dateProfile);
-		this.updateTitle();
-		this.calendar.updateToolbarButtons();
 
 		if (this.render) {
 			this.render(); // TODO: deprecate