فهرست منبع

view is in charge of updating toolbar buttons

Adam Shaw 9 سال پیش
والد
کامیت
4f1404ad99
2فایلهای تغییر یافته به همراه5 افزوده شده و 7 حذف شده
  1. 3 7
      src/Calendar.js
  2. 2 0
      src/common/View.js

+ 3 - 7
src/Calendar.js

@@ -671,15 +671,11 @@ function Calendar_constructor(element, overrides) {
 						currentView.captureInitialScroll(forcedScroll);
 					}
 
-					currentView.setDate(date, forcedScroll);
+					currentView.setDate(date);
 
 					if (forcedScroll) {
 						currentView.releaseScroll();
 					}
-
-					// need to do this after View::render, so dates are calculated
-					// NOTE: view updates title text proactively
-					updateToolbarsTodayButton();
 				}
 			}
 		}
@@ -872,7 +868,7 @@ function Calendar_constructor(element, overrides) {
 	};
 
 
-	function updateToolbarsTodayButton() {
+	t.updateToolbarButtons = function() {
 		var now = t.getNow();
 		if (now >= currentView.intervalStart && now < currentView.intervalEnd) {
 			toolbarsManager.proxyCall('disableButton', 'today');
@@ -880,7 +876,7 @@ function Calendar_constructor(element, overrides) {
 		else {
 			toolbarsManager.proxyCall('enableButton', 'today');
 		}
-	}
+	};
 
 
 

+ 2 - 0
src/common/View.js

@@ -580,6 +580,8 @@ var View = FC.View = Class.extend(EmitterMixin, ListenerMixin, {
 			_this.isDateRendered = true;
 			_this.onDateRender();
 			_this.trigger('dateRender');
+
+			_this.calendar.updateToolbarButtons();
 		});
 	},