I'm working on a grouped ListView / Grid with two virtualized data sources (one for items and one for Groups). Individually, these data sources work fine and can read & write data via JSON.
However, when I Change an item in this grouped listView, the app terminates with an exception claiming that "The key must be a string.". I spent some time in the Debugger and tracked this issue down to line 8349 in ui.js:
return new Promise(function (complete, error) {
var itemOld;
queueEdit(
// applyEdit
function () {
return listDataAdapter.change(key, newData, adjustedIndex(slot));
},
EditType.change, complete, error,
// keyUpdate
null,
// updateSlots
function () {
itemOld = slot.item;
slot.itemNew = {
key: key,
data: newData
};
if (itemOld) {
changeSlot(slot);
} else {
completeFetchPromises(slot);
} },
// undo
function () {
if (itemOld) {
slot.itemNew = itemOld;
changeSlot(slot);
} else {
beginRefresh();
}
}
);
});
As you can see, a new item is created on the fly with the key and data properties but without a groupKey property, even though itemOld had a groupKey assigned at that point.
This Problem occurs even if my data Adapter's Change method just Returns WinJS.Promise.wrap(null) without making any changes at all.
How can I work around this?