Load range of events.
Load range of events.
Hi,
I have a simple calendar panel like your mvvm example, the only difference is that our stores are type rest.
The problem is that it load all events, can I load only the events of the loaded view (day / week / month)?
And when press previous/next buttons load only the range of events appropriate?
Load all events in one request its crazy :S
Code: Select all
Ext.define('Cal.view.MainPanel', {
extend : 'Cal.panel.Calendar',
alias : 'widget.mvvm-mainpanel',
requires : ['Cal.view.MainPanelController','Cal.view.MainPanelModel'],
controller : 'mvvm-controller',
viewModel : {type : 'mvvm-viewmodel'},
title : 'MVVM Calendar',
date : new Date(2019, 9, 14),
bind : {
eventStore : '{events}',
resourceStore : '{calendars}'
}
});
ViewModel:
Ext.define('Cal.view.MainPanelModel',{
extend : 'Ext.app.ViewModel',
alias : 'viewmodel.mvvm-viewmodel',
stores : {
calendars : {
type : 'calendarresourcestore',
storeId : 'resource',
autoLoad:true,
proxy: {
type: 'rest',
url: 'rest/calendar',
reader: {type: 'json'}
},
},
events : {
type : 'calendareventstore',
storeId : 'event',
autoLoad:true,
proxy: {
type: 'rest',
url: 'rest/events',
reader: {type: 'json'}
}
}
}
});
thanks for your help.
- Maxim Gorkovsky
- Core Developer
- Posts: 3309
- Joined: Wed Jan 08, 2014 11:46 am
Re: Load range of events.
Hello.
You'd need to listen to view change event and load event store passing additional params to the request. See this doc article: https://docs.sencha.com/extjs/7.1.0/classic/Ext.data.ProxyStore.html#method-load
Re: Load range of events.
Hi,
Thank you for your feedback
Does prev./next/today buttons throw viewChange event?
Or do I need to add listeneres for every click button event and every change event? :S
- Maxim Gorkovsky
- Core Developer
- Posts: 3309
- Joined: Wed Jan 08, 2014 11:46 am
Re: Load range of events.
Please refer to the doc. You can find number of events triggered by calendar panel there. You can try using this one: https://www.bryntum.com/docs/calendar-for-extjs/#!/api/Cal.panel.Calendar-event-beforemodechange