Browse Source

fix: apply sort in shared view

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/679/head
Pranav C 3 years ago
parent
commit
36e904d817
  1. 9
      packages/nocodb/src/lib/noco/meta/NcMetaMgrEE.ts

9
packages/nocodb/src/lib/noco/meta/NcMetaMgrEE.ts

@ -152,6 +152,7 @@ export default class NcMetaMgrEE extends NcMetaMgr {
};
let where = '';
const sort = [];
if (req.query.where) {
where += req.query.where;
@ -160,6 +161,13 @@ export default class NcMetaMgrEE extends NcMetaMgr {
if (queryParams.where) {
where += where ? `~and(${queryParams.where})` : queryParams.where;
}
if (queryParams.sort) {
sort.push(...queryParams.sort.split(','));
}
if (req.query.sort) {
sort.push(...req.query.sort.split(','));
}
const fields = meta.columns.map(c => c._cn).join(',');
@ -210,6 +218,7 @@ export default class NcMetaMgrEE extends NcMetaMgr {
...req.query,
where,
fields,
sort: sort.join(','),
...nestedParams
}),
...(await model.countByPk({

Loading…
Cancel
Save