CroudTech / vue-fullcalendar

FullCalendar Wrapper for vue
MIT License
483 stars 100 forks source link

Can't catch actions next or prev buttons #127

Closed ManoogD closed 6 years ago

ManoogD commented 6 years ago

Hi. I'm sorry I'm writing here because I don't know where to write else. I tried to find somewhere or somehow how to get action when there is click on next or prev buttons but didn't find anything. My problem is also described here https://stackoverflow.com/questions/50887335/vue-full-calendar-next-prev-buttons-trigger. Is there way to do this without jquery? Thanks.

BrockReece commented 6 years ago

Hi @ManoogD

I'm not sure how familiar you are with Fullcalendar, you can define your events in a function (see their docs). This function will run every time the user presses the next and prev buttons or switches the view.

config: {
  events(start, end, timezone, callback) {
    // do something
    callback(arrOfEvents)
  },
}

infact our main Readme shows an example of this technique for multiple event sources https://github.com/CroudTech/vue-fullcalendar#using-a-json-feed

Does this help or was there something more specific you were after?

ManoogD commented 6 years ago

@BrockReece Thank you for you response! Right now I did with eventSources and it works fine! I'm using websocket and in my project everyone who has subscribed to the topic should get notification as a event without refresh page. Now I get a single event and can't understand how to put in to array of exists events and render it.

ManoogD commented 6 years ago

@BrockReece I just don't know is it good to use something like this: full-calendar id="cc" :config="config" :events="events" :event-sources="eventSources" ??? Because it lets me make first query with eventSource and I also make equals to events. After that all incoming events just put in existing array of events and it should work.

ManoogD commented 6 years ago

I'm ready to refactor my backend because it's more easy for me because I'm backend engineer and not so much familiar to frontend :) Most important thing to make good calendar with all planned features. Thanks

ManoogD commented 6 years ago

ohhhh I GOT IT! if we use eventSources we also can push into the array. I thought if we use in array function we can't push to it anything. Ohhh it's so cool! Now it render from function events(start,end,etc), and after this I can push into this single event. THANK YOU

BrockReece commented 6 years ago

Ha, glad you sorted it out. I think I have just watched some first class rubber duck programming in action.

DivingPigy commented 6 years ago

Seems helpful for me!

DivingPigy commented 6 years ago

I solve the event problem, but timezone is disturbing me, I am in China, but timezone sets in America!