damiengarbarino/dojo-calendar — Issue #6: renderItemToItem() doesn't reference the correct field names in the renderItem object
Author: matt-dns
Created: 2012-03-07 01:26:12+00:00
State: open

from what I understand, the rendered item always uses the default field names until it is converted to a standard item, so renderItemToItem() should be using startTime/endTime/etc as keys for the renderItem object. However, it's currently using the user-defined field names (startTimeAttr, endTimeAttr), which doesn't seem correct.

Here's a patch.

```
diff --git a/StoreMixin.js b/StoreMixin.js
index f5beadb..a42d866 100644
--- a/StoreMixin.js
+++ b/StoreMixin.js
@@ -113,9 +113,9 @@ define(["dojo/_base/declare", "dojo/_base/array", "dojo/_base/html", "dojo/_base
}
var item = {};
item[store.idProperty] = renderItem.id;
- item[this.summaryAttr] = renderItem[this.summaryAttr];
- item[this.startTimeAttr] = (this.encodeDate && this.encodeDate(renderItem[this.startTimeAttr])) || renderItem[this.startTimeAttr];
- item[this.endTimeAttr] = (this.encodeDate && this.encodeDate(renderItem[this.endTimeAttr])) || renderItem[this.endTimeAttr];
+ item[this.summaryAttr] = renderItem.summary;
+ item[this.startTimeAttr] = (this.encodeDate && this.encodeDate(renderItem.startTime)) || renderItem.startTime;
+ item[this.endTimeAttr] = (this.encodeDate && this.encodeDate(renderItem.endTime)) || renderItem.endTime;
return lang.mixin(store.get(renderItem.id), item);
},
```

This resolves the assertion failure that I was experiencing with the ItemFileWriteStore.