|
|
@ -207,6 +207,30 @@ export default async function sortV2( |
|
|
|
qb.orderBy(selectQb, sort.direction || 'asc'); |
|
|
|
qb.orderBy(selectQb, sort.direction || 'asc'); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case UITypes.SingleSelect: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const clientType = knex.clientType(); |
|
|
|
|
|
|
|
if (clientType === 'mysql' || clientType === 'mysql2') { |
|
|
|
|
|
|
|
qb.orderBy(sanitize(knex.raw('CONCAT(??)', [column.column_name])), sort.direction || 'asc'); |
|
|
|
|
|
|
|
} else if (clientType === 'mssql') { |
|
|
|
|
|
|
|
qb.orderBy(sanitize(knex.raw('CAST(?? AS VARCHAR(MAX))', [column.column_name])), sort.direction || 'asc'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
qb.orderBy(sanitize(column.column_name), sort.direction || 'asc'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case UITypes.MultiSelect: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const clientType = knex.clientType(); |
|
|
|
|
|
|
|
if (clientType === 'mysql' || clientType === 'mysql2') { |
|
|
|
|
|
|
|
qb.orderBy(sanitize(knex.raw('CONCAT(??)', [column.column_name])), sort.direction || 'asc'); |
|
|
|
|
|
|
|
} else if (clientType === 'mssql') { |
|
|
|
|
|
|
|
qb.orderBy(sanitize(knex.raw('CAST(?? AS VARCHAR(MAX))', [column.column_name])), sort.direction || 'asc'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
qb.orderBy(sanitize(column.column_name), sort.direction || 'asc'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
default: |
|
|
|
default: |
|
|
|
qb.orderBy(sanitize(column.column_name), sort.direction || 'asc'); |
|
|
|
qb.orderBy(sanitize(column.column_name), sort.direction || 'asc'); |
|
|
|
break; |
|
|
|
break; |
|
|
|