Sorter.js 610 B

1234567891011121314151617181920212223242526
  1. Ext.define('saas.override.util.Sorter', {
  2. override: 'Ext.util.Sorter',
  3. sortFn: function (item1, item2) {
  4. var me = this,
  5. transform = me._transform,
  6. root = me._root,
  7. property = me._property,
  8. lhs, rhs;
  9. if (root) {
  10. item1 = item1[root];
  11. item2 = item2[root];
  12. }
  13. lhs = item1[property] || '';
  14. rhs = item2[property] || '';
  15. if (transform) {
  16. lhs = transform(lhs);
  17. rhs = transform(rhs);
  18. }
  19. return (lhs > rhs) ? 1 : (lhs < rhs ? -1 : 0);
  20. },
  21. });