Closed oztek22 closed 6 years ago
I modified ngx-order.pipe.ts to handle the case sensitivity issue for sorting string:
private sortArray(value: any[], expression?: any, reverse?: boolean): any[] { const isDeepLink = expression && expression.indexOf('.') !== -1; if (isDeepLink) { expression = OrderPipe.parseExpression(expression); } let array: any[] = value.sort((a: any, b: any): number => { if (!expression) { return a > b ? 1 : -1; } if (!isDeepLink) { let aVal = a[expression], bVal = b[expression]; if (typeof aVal === 'string') { aVal = aVal.toLowerCase(); } if (typeof bVal === 'string') { bVal = bVal.toLowerCase(); } return aVal > bVal ? 1 : -1; } return OrderPipe.getValue(a, expression) > OrderPipe.getValue(b, expression) ? 1 : -1; }); if (reverse) { return array.reverse(); } return array; }
I modified ngx-order.pipe.ts to handle the case sensitivity issue for sorting string: