PropertyGroupDescription Class

File
wijmo.js
Module
wijmo.collections
Base Class
GroupDescription
Show
   

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);

Constructor

Methods

Constructor

constructor

constructor(property: string, converter?: Function): PropertyGroupDescription

Initializes a new instance of the PropertyGroupDescription class.

Parameters
Returns
PropertyGroupDescription

Methods

groupNameFromItem

groupNameFromItem(item: any, level: number): any

Returns the group name for the given item.

Parameters
Returns
any

namesMatch

namesMatch(groupName: any, itemName: any): boolean

Returns a value that indicates whether the group name and the item name match (which implies that the item belongs to the group).

Parameters
Returns
boolean