fix(DataTablesSsp): clamp offset and limit values
This commit is contained in:
parent
5e868f9dad
commit
f739a92e1e
1 changed files with 2 additions and 2 deletions
|
|
@ -67,8 +67,8 @@ export class DataTablesSsp {
|
||||||
private joinSql = "";
|
private joinSql = "";
|
||||||
|
|
||||||
public constructor(query: Query, db: Pool, table: string, primaryKey: string, columnSettings: IColumnSettings[]) {
|
public constructor(query: Query, db: Pool, table: string, primaryKey: string, columnSettings: IColumnSettings[]) {
|
||||||
this.start = parseInt(query.start as string, 10);
|
this.start = Math.max(0, parseInt(query.start as string, 10));
|
||||||
this.length = parseInt(query.length as string, 10);
|
this.length = Math.min(100, Math.max(0, parseInt(query.length as string, 10)));
|
||||||
this.draw = parseInt(query.draw as string, 10);
|
this.draw = parseInt(query.draw as string, 10);
|
||||||
this._order = (query.order as { column: string; dir: string }[]).map((order) => {
|
this._order = (query.order as { column: string; dir: string }[]).map((order) => {
|
||||||
return { column: parseInt(order.column, 10), dir: order.dir };
|
return { column: parseInt(order.column, 10), dir: order.dir };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue