| Issue 2119: | Reorganize Events / Sources with ids to be more flexible | |
| 1 person starred this issue and may be notified of changes. | Back to list |
I would like to suggest a slight extension of existing event and eventsource classes, to be more flexible. What about putting an id to the eventsource and connecting the both entities with a hasmany relationship. Example:
{
events:[
{
id:1,
title:'Event1',
start:'2011-04-04',
source:1
},
{
id:2,
title:'Event2',
start:'2011-05-05',
source:2,
},
{
id:3,
title:'Event3',
start:'2011-05-05',
source:1,
}
],
eventsources:[
{
id:1,
name:'First Source',
url:'http://mysource.com/?source=1',
color:'#000',
className:'eventsource1'
},
{
id:2,
name:'Seconds Source',
url:'http://mysource.com/?source=2',
color:'#FFF',
className:'eventsource2'
}
]
}
Benefits:
- The existing structure follows the jsonapi.org standards
- Applications based on relational databases would be easier to implement
Jun 7, 2014
Project Member
#1
adamrs...@gmail.com
Status:
Done
Jun 8, 2014
Just to give you an Example, how powerful the resulting structure is, you could take a look at emberjs and ember-data, which is taking advantage of jsonapi.org. I hacked together a sample, which is a bit complex, but i marked the "magic"-parts with /** comments **/. To see the results, you have to tap on "run with js" one time i think, auto-execution often fails http://emberjs.jsbin.com/retobebu/3/edit?html,js,output Basic knowledge: - Ember-Models can have properties AND relationships to other models (belongsTo, hasMany) - Model properties and its Relationships are resolved automatically by the store (read, but also create, update and delete!!!) - resolved relationships work with promises, so currently the store is "fixture", which means the things are not persisted - to connect the sample app completely to localstorage or a jsonapi, you just have to change 3 lines of code (see first comments). Thats it. - the template engine of emberjs (called handlebars) are bound to the things in the store via controller-properties, see the html part for that (<li>{{item.title}} ({{item.source.name}}, here item is an event, item.source.name is a source-relationships name) When you take a look at the sample, don't be too scared of the many lines of code, if you need explanation, just ask ;)
Jun 8, 2014
(No comment was entered for this change.)
Status:
Discussing
Jun 8, 2014
(No comment was entered for this change.)
Labels:
Type-Feature
Aug 21, 2015
Discussion for this issue has moved to the following URL: https://github.com/fullcalendar/fullcalendar/issues/2384 This is because Google Code is shutting down. Apologies if you are being pestered with these notifications. This is a one-time event. Happy coding, Adam
Status:
ExportedToGithub
|
|
| ► Sign in to add a comment |