我正在使用启用了Pager的后端服务器(
@L_502_0@ Spring).我在HTTP调用上每页加载100条记录.
在angular2服务上,它使用“?page = 1& size = 100”作为初始调用的API调用,而在客户端大小的寻呼机上,它显示10并且最多移动10页,这很好.但我无法从服务器加载下一块数据.我检查了ServerDataSource并使用了.setPaging(1,100).
如何加载下一个数据块(2-200)以及如何实现此目的.任何提示都会有所帮助.
@Injectable() export class AmazonService extends ServerDataSource { constructor(protected http: Http) { super(http); } public getAmazon@R_465_4045@ion(page,size): Observable<Amazon[]> { let url = 'http://localhost:8080/plg-amazon?page=1&size=100'; this.setPaging(1,100,true); if (this.pagingConf && this.pagingConf['page'] && this.pagingConf['perPage']) { url += `page=${this.pagingConf['page']}&size=${this.pagingConf['perPage']}`; } return this.http.get(url).map(this.extractData).catch(this.handleError); }
谢谢!
解决方法
尝试将设置设置为智能表,如下所示
<ng2-smart-table #grid [settings]="settings" ... >
在您的组件中,定义设置,如下所示:
public settings: TableSettings = new TableSettings(); ngOnInit(): void { ... this.settings.pager.display = true; this.settings.pager.perPage = 100; ... }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。