dw.util
Class FilteringCollection
FilteringCollection is an extension of
Collection which provides possibilities to
- filter the elements to return a new FilteringCollection with a filtered set of elements
- sort the elements to return a new FilteringCollection with a defined sort order
- transform the elements to return a new FilteringCollection containing related elements
- provide a map of the elements against a predefined key
var allItems : FilteringCollection = shippingOrder.items;
var productItems : FilteringCollection = allItems.select(ShippingOrder.QUALIFIER_PRODUCTITEMS);
var serviceItems : FilteringCollection = allItems.select(ShippingOrder.QUALIFIER_SERVICEITEMS);
var byPosition : FilteringCollection = productItems.sort(ShippingOrder.ORDERBY_ITEMPOSITION);
var revByPosition: FilteringCollection = byPosition.sort(FilteringCollection.ORDERBY_REVERSE);
var mapByItemID : Map = allItems.asMap();
Constants
ORDERBY_REVERSE
:
Object
Pass this orderBy with the sort(Object) method to
obtain a new FilteringCollection with the reversed sort
order. Only use on a FilteringCollection which has been
previously sorted.
Properties
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
asMap()
:
Map
Returns a Map containing the elements of this FilteringCollection against a predefined key.
select(qualifier
:
Object)
:
FilteringCollection
Select a new FilteringCollection instance by passing a predefined qualifier as an argument to this method.
sort(orderBy
:
Object)
:
FilteringCollection
Select a new FilteringCollection instance by passing a predefined orderBy as an argument to this method.
Methods inherited from class
Collection
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Method Detail
asMap
asMap()
:
Map
Returns a Map containing the elements of this
FilteringCollection against a predefined key. The key
used is documented in the method returning the
FilteringCollection and is typically the ItemID assigned
to an element in the collection.
Returns:
a Map containing the elements of this FilteringCollection against a predefined key.
select
Select a new FilteringCollection instance by passing a
predefined qualifier as an argument to this method. See
FilteringCollection.
Parameters:
qualifier
-
- possible qualifiers are documented in the method returning the FilteringCollection
Returns:
a new FilteringCollection instance
sort
Select a new FilteringCollection instance by passing a
predefined orderBy as an argument to this method. See
FilteringCollection.
Parameters:
orderBy
-
- possible orderBys are documented in the method returning the FilteringCollection
Returns:
a new FilteringCollection instance