[]
        
(Showing Draft Content)

PropertyGroupDescription Class

PropertyGroupDescription Class

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

Heirarchy

Constructors

Properties

Methods

Constructors

constructor

  • Initializes a new instance of the PropertyGroupDescription class.

    Parameters

    • property: string

      The name of the property that specifies which group an item belongs to.

    • Optional converter: IGroupConverter

      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.

    Returns PropertyGroupDescription

Properties

propertyName

propertyName: string

Gets the name of the property that is used to determine which group an item belongs to.

Methods

groupNameFromItem

  • groupNameFromItem(item: any, level: number): any
  • Returns the group name for the given item.

    Parameters

    • item: any

      The item to get group name for.

    • level: number

      The zero-based group level index.

    Returns any

    The name of the group the item belongs to.

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

    • groupName: any

      The name of the group.

    • itemName: any

      The name of the item.

    Returns boolean

    True if the names match; otherwise, false.