| Client-Side API Reference > CollectionView > PropertyGroupDescription Class |
constructor(property: string, converter?: Function): PropertyGroupDescription
Initializes a new instance of the PropertyGroupDescription class.
The name of the property that specifies which group an item belongs to.
A callback function that takes an item and a property name and returns the group name. If not specified, the group name is the property value for the item.
Describes the grouping of items using a property name as the criterion.
For example, the code below causes a CollectionView to group items by the value of their 'country' property:
var cv = new wijmo.collections.CollectionView(items); var gd = new wijmo.collections.PropertyGroupDescription('country'); cv.groupDescriptions.push(gd);You may also specify a callback function that generates the group name. For example, the code below causes a CollectionView to group items by the first letter of the value of their 'country' property:
var cv = new wijmo.collections.CollectionView(items); var gd = new wijmo.collections.PropertyGroupDescription('country', function(item, propName) { return item[propName][0]; // return country's initial }); cv.groupDescriptions.push(gd);