Answered by:
Changes in RTM and the ListView.layout.groupInfo property

Question
-
Hi,
I just updated my application to RTM and i'm running into an issue with ListView that have different templates / sizes. In the samples:
http://code.msdn.microsoft.com/windowsapps/ListView-item-templates-7d74826f
A groupInfo property is set to:
groupInfo : function () {
return {
enableCellSpanning: true,
cellWidth: 250,
cellHeight: 250
};
},
Which worked well in RC. Now I get an exception in UI.js:
Exception is about to be caught by JavaScript library code at line 17565, column 25 in ms-appx://microsoft.winjs.1.0/js/ui.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method '_getGroup'Here are the lines where it crashes:
// For multisize instead of using the first item size use the slot size of the first group.
var groupInfo;
if (typeof that._groupInfo === "function") {
var group0 = that._getGroup(0);
if (group0) {
groupInfo = that.groupInfo(group0.userData);
}
} else {
groupInfo = that._groupInfo;
}It looks like it would be normal that it would crash because the _getGroup function is not defined in my object. I checked the samples and it's still the same code.
Should I add a _getGroup method to my object? What would it contain?
Thanks for your help!
Fabien
Sunday, August 26, 2012 7:38 PM
Answers
-
Hi Fabien,
I cannot tell what is going on from so little code. Did you notice that now the groupInfo() in the sample looks like this?
// Enable cell spanning in ListView and specify // the cellWidth and cellHeight for the items var groupInfo = WinJS.Utilities.markSupportedForProcessing(function groupInfo() { return { enableCellSpanning: true, cellWidth: 310, cellHeight: 80 }; });
-JeffJeff Sanders (MSFT)
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, August 27, 2012 6:36 PM
Monday, August 27, 2012 6:07 PMModerator
All replies
-
Hi Fabien,
I cannot tell what is going on from so little code. Did you notice that now the groupInfo() in the sample looks like this?
// Enable cell spanning in ListView and specify // the cellWidth and cellHeight for the items var groupInfo = WinJS.Utilities.markSupportedForProcessing(function groupInfo() { return { enableCellSpanning: true, cellWidth: 310, cellHeight: 80 }; });
-JeffJeff Sanders (MSFT)
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, August 27, 2012 6:36 PM
Monday, August 27, 2012 6:07 PMModerator -
Hello Jeff,
Yes, they added the markSupportedForProcessing for RTM but it's not necessary in my case because groupInfo is defined in a .define(...) block which automatically mark functions supportedForProcessing.
I found a way out of this problem, i actually don't need to have different sized elements when in snap mode because big elements don't even fit so I just don't assign groupInfo when snapped
Nevermind :)
Fabien
Monday, August 27, 2012 6:26 PM