sorts controls according to some criteria

void sort(object rule);


ruleobjectan object with parameters for sorting

    by: "price",
    dir: "asc",
    as: function (value) { return value ? value : "" }


The rule object has the following attributes:

  • by - (string) the id of a data field (a column of TreeGrid)
  • dir - (string) the direction of sorting "asc" or "desc"
  • as - (function) a function that specifies the type to sort data as
  • rule - (function) optional, a sorting rule; the function must have two parameters and return a number (-1,0,1)

Calling the method without parameters will discard all applied sorting rules.

Custom sorting

To set a custom function for sorting you need to specify the rule attribute in a passed object. For example:{
    rule: (a,b) => (a.type < b.type) ? -1 : ( (a.type > b.type) ? 1 : 0 )
Back to top