extjs - Rally SDK 2 custom sorters -
how more complex sort on query, have query currently:
var store = ext.create('rally.data.custom.store',{ data: changes, limit: 'infinity', pagesize: 5000, sorters: [ { property: 'releasescope', direction: 'asc' }, { property: 'schedulestate', direction: 'desc' } ] }); because schedulestate hydrated can't sort normal numerics, can define order using kind of matcher?
i.e. want show in order [accepted, completed, in-progress, defined, backlog] and, if wanted complicate further , show stories story points first, like
all stories story point value != 0 sorted schedulestate [accepted, completed, in-progress, defined etc..] stories no story point value other sort here possibly
you can pass sorterfn rather property/direction combo implement custom sort logic:
sorters: [ { sorterfn: function(a, b) { var schedulestates = ['accepted', 'completed', 'in-progress', 'defined'], astate = a.get('schedulestate'), aindex = _.indexof(schedulestates, astate), bstate = b.get('schedulestate'), bindex = _.indexof(schedulestates, bstate); return - b; } } ] the above function should sort them based on schedule state descending think.
Comments
Post a Comment