开发者

how to trigger viewDisplay only when a view is changed

Is there a way to limit viewDisplay event t开发者_JAVA百科o be triggered only when the view (day, week, month) is changed and not when next/previous/today is clicked?


Ahh yes- I thought i was the only one that thought this was a bit misleading and lodged a bug....

Here you go.

You need to define a global variable before the calendar loads! Leave it undefined- or change it how you like. This also solves another bug- it prevents the viewChange event from firing TWICE when the calendar loads :)

var listView

Then in the calendar init

viewDisplay: function(view) {
  if (lastView == undefined) { lastView = 'firstRun';  }

  if (view.name != lastView )
  {
        if (view.name == 'month') 
          { 
            //What todo for month?
          }
         if (view.name == 'basicDay') 
          { 
            //What todo for BasicDay
          }
   lastView = view.name;
  }

This is what I use currently to overcome this problem. But you have to hard codeall views into the code.. which is not good really.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜