6 | | if(this.sortByLabel && !fetchArgs.sort && items.length){ |
7 | | if(items[0].getValue){ |
8 | | // Old dojo.data API to access items, remove for 2.0 |
9 | | items.sort(sorter.createSortFunction([{ |
10 | | attribute: store.getLabelAttributes(items[0])[0] |
11 | | }], store)); |
12 | | }else{ |
13 | | var labelAttr = this.labelAttr; |
14 | | items.sort(function(a, b){ |
15 | | return a[labelAttr] > b[labelAttr] ? 1 : b[labelAttr] > a[labelAttr] ? -1 : 0; |
16 | | }); |
17 | | } |
18 | | } |
| 6 | |
| 7 | {{{ |
| 8 | if(this.sortByLabel && !fetchArgs.sort && items.length){ |
| 9 | if(items[0].getValue){ |
| 10 | ... |
| 11 | }}} |
22 | | if (this.sortByLabel && !fetchArgs.sort && items.length) { |
23 | | if (store.getValue) { |
24 | | // Old dojo.data API to access items, remove for 2.0 |
25 | | items.sort(sorter.createSortFunction([{ |
26 | | attribute: store.getLabelAttributes(items[0])[0] |
27 | | }], store)); |
28 | | } else { |
29 | | var labelAttr = this.labelAttr; |
30 | | items.sort(function (a, b) { |
31 | | return a[labelAttr] > b[labelAttr] ? 1 : b[labelAttr] > a[labelAttr] ? -1 : 0; |
32 | | }); |
33 | | } |
34 | | } |
| 15 | {{{ |
| 16 | if (this.sortByLabel && !fetchArgs.sort && items.length) { |
| 17 | if (store.getValue) { |
| 18 | ... |
| 19 | }}} |