Helma logo
helma.org » Home > Stories > HopObject.getOrderedView()

HopObject.getOrderedView()

Returns a collection including all subnodes of a HopObject ordered according to the properties listed in the string passed as argument.

Syntax
HopObject.getOrderedView(String)

While the sort pattern, passed as string argument, uses an SQL-like notation for the sorting, it contains property names, not database column names.

The method returns a collection object that is ordered according to the specified sort order.

The returned collections are cached and bound to the original collections, i.e. they reflect changes to the original collection. Both initial ordering and re-ordering are done on the Helma side, meaning that no additional db traffic is generated by multiple ordered views.

Example

var orderedByDate = hobj.getOrderedView("createtime desc, name");
for (var i in orderedByDate) {
  doSomething();
}
// other syntax examples:
var orderedByName = hobj.getOrderedView("name");
var collectionByName = hobj.collection.getOrderedView("name");


... comment


Page last modified on 2006-09-23 13:10 by czv