Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ng2智能表响应代码句柄请求_Javascript_Angular_Typescript_Ng2 Smart Table - Fatal编程技术网

Javascript ng2智能表响应代码句柄请求

Javascript ng2智能表响应代码句柄请求,javascript,angular,typescript,ng2-smart-table,Javascript,Angular,Typescript,Ng2 Smart Table,我使用Ng2-Smart table进行服务器端分页,我自定义了对服务器的post请求。服务器用数据以及重新编码进行响应。根据重新编码,我需要将数据加载到Smart table I,e source: PostServerDataSource; this.source1 = new PostServerDataSource(this.http, { endPoint: this.service.apiURL + 'report/failureFileReport',

我使用Ng2-Smart table进行服务器端分页,我自定义了对服务器的post请求。服务器用数据以及重新编码进行响应。根据重新编码,我需要将数据加载到Smart table I,e

    source: PostServerDataSource; 
this.source1 = new PostServerDataSource(this.http, {
          endPoint: this.service.apiURL + 'report/failureFileReport', dataKey: 'data', pagerLimitKey: "_limit",
          pagerPageKey: "_page",
          sortDirKey: "pageable",
          sortFieldKey: "pageable",
          totalKey: 'totalElements',
        }, request);
        if(this.source1.rescode === '0000'){
          this.source =this.source1.data;
        }  else if (this.source1.rescode == "0001") {
          this.toastyService.error(this.source1.ErrorDescription);
        } else if (this.source1.rescode == "0002") {
          this.toastyService.error(this.source1.ErrorDescription);
        }
这是用于post请求的自定义ServerDataSource

export  class PostServerDataSource extends ServerDataSource {
        currentUser:any;
        params: any;
        sridharan:any;
        constructor(http: HttpClient, config: any, params?: any) {
            super(http, config);
            this.params = params;
        }
        protected requestElements(): Observable<any> {
            let httpParams = this.createRequesParams();
            if (this.params) {
              let keys = Object.keys(this.params);
              keys.forEach((key) => {
                  httpParams = httpParams.set(key, this.params[key]);
              });
            }
            const data = Object.assign(this.params, httpParams);
            return this.http.post(this.conf.endPoint, httpParams, { observe: 'response' })
        }
导出类PostServerDataSource扩展ServerDataSource{
当前用户:任何;
参数:任何;
斯里德哈兰:任何;
构造函数(http:HttpClient,config:any,params?:any){
超级(http,config);
this.params=params;
}
受保护的requestElements():可观察{
让httpParams=this.createRequesParams();
if(this.params){
让keys=Object.keys(this.params);
key.forEach((key)=>{
httpParams=httpParams.set(key,this.params[key]);
});
}
const data=Object.assign(this.params,httpParams);
返回this.http.post(this.conf.endPoint,httpParams,{observe:'response'})
}

您面临的问题是什么?能否使用stackblitz添加示例演示您面临的问题是什么?能否使用stackblitz添加示例演示