|
Lines 235-250
Link Here
|
| 235 |
if (column.hasOwnProperty('sortFormatter')) { |
235 |
if (column.hasOwnProperty('sortFormatter')) { |
| 236 |
sortFormatter = column.sortFormatter; |
236 |
sortFormatter = column.sortFormatter; |
| 237 |
} |
237 |
} |
|
|
238 |
var stringCompare = function() { |
| 239 |
if (typeof(Intl) === 'object' && typeof(Intl.Collator) === 'function') { |
| 240 |
var intlCollator = new Intl.Collator(kernel.locale, {numeric: true}); |
| 241 |
return function(a, b) { |
| 242 |
return intlCollator.compare(a, b) < 0; |
| 243 |
}; |
| 244 |
} |
| 245 |
return function(a, b) { |
| 246 |
return a.toLowerCase() < b.toLowerCase(); |
| 247 |
}; |
| 248 |
}(); |
| 238 |
var compare = function(aValue, bValue) { |
249 |
var compare = function(aValue, bValue) { |
| 239 |
var a = sortFormatter(aValue); |
250 |
var a = sortFormatter(aValue); |
| 240 |
var b = sortFormatter(bValue); |
251 |
var b = sortFormatter(bValue); |
| 241 |
if (typeof(a.localeCompare) === 'function') { |
252 |
if (typeof(a) === 'string' && typeof(b) === 'string') { |
| 242 |
return a.localeCompare(b, kernel.locale, {numeric: true}) < 0; |
253 |
return stringCompare(a, b); |
| 243 |
} else if (typeof(a.toLowerCase) === 'function') { |
|
|
| 244 |
return a.toLowerCase() < b.toLowerCase(); |
| 245 |
} else { |
| 246 |
return a < b; |
| 247 |
} |
254 |
} |
|
|
255 |
return a < b; |
| 248 |
}; |
256 |
}; |
| 249 |
return function(data) { |
257 |
return function(data) { |
| 250 |
var comparison; |
258 |
var comparison; |