-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I want to use a Observable Cache of JsonRest and Memory store but with different identity, in my case "idPlanificacion", but the calendar behavior is wrong on create new items, it does not allows me to drag either.
My Code:
var id = 1,
jsonStore = new JsonRest({target:"/planificaciones", idProperty: "idPlanificacion"}),
cacher = new Memory({idProperty: "idPlanificacion"}),
store = new Observable(new Cache(jsonStore, cacher));
var calendar = new Calendar({
dateInterval: "week",
columnViewProps: {
timeSlotDuration: 60,
minHours: 0,
maxHours: 24,
hourSize: 25
},
store: store,
editable: true,
createOnGridClick: true,
createItemFunc: createItem,
templateString: template
}, "calendar-wrap");After a few hours I found that it may because the StorageManager does not get the identity in some cases:
for(i=l-1; i>=0; i--){
if(this.items[i].id === tempId){
this.items[i] = newItem;
break;
}
}then again in the line 117
if(this.items && this.items[newIndex] && this.items[newIndex].id !== newItem.id){
l = this.items.length;
for(i=l-1; i>=0; i--){
if(this.items[i].id === newItem.id){
this.items.splice(i, 1);
break;
}
}
this.items.splice(newIndex, 0, newItem);
}The identity of items are evaluate directly for "id". And I think this is the bug because when I change the properties of my store, set the idProperty to "id" everything works fine again.
Metadata
Metadata
Assignees
Labels
No labels