akveo / akveo/ng2-smart-table

using "POST" instead of "GET" for pagination how to add extra parameters in body ?

Abierto
#1,057 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1.6k
Forks
867
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I've checked the document and source code for pagination implementation (advanced-example-server.component.ts). And found that the ServerDataSource it used had only implemented pagination via HTTP GET (_sort, _limit, _page, etc parameters expose in URL)..... as my currently project worked on required to use POST to send front-end parameters to back-end Restful APIs using extends to HTTP post call implement, I don't know how to add the extra parameters in pagination request. I Need To pass the request_server to extendsplugin.ts
[](https://www.pipiscrew.com/2019/06/from-wenzhixin-bootstrap-table-to-angular-akveo-ng2-smart-table/)
```
import { Observable } from 'rxjs/internal/Observable';
import { ServerDataSource } from 'ng2-smart-table';

export class PostServerDataSource extends ServerDataSource {

protected requestElements(): Observable {
let httpParams = this.createRequesParams();
return this.http.post(this.conf.endPoint, request_server, { observe: 'response' });
}

}
```

anotherComponent.ts

```
swiftListTable() {
const request_server = JSON.stringify({ "userType": this.currentUser.role, "authName": this.currentUser.username })
this.source = new PostServerDataSource(this.http,{endPoint: this.service.apiURL + 'swift/pagination', dataKey: 'content', pagerLimitKey:"_limit",
pagerPageKey:"_page",
sortDirKey: "pageable",
sortFieldKey: "pageable",
totalKey:'totalElements'});
}
```
}
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.