Ng-alain st component failed to get data, postman shows that api has returned data.

for example, there is no problem with using mock data, and an exception will occur if you replace it with an api address.
after testing, the following problems are found:
post the st component first:
< st-sharpst [data] = "queryData" [columns] = "columns" size="small" (checkboxChange) = "checkboxChange ($event)" > < / st >

ts file:
queryData = "api/xxxx".
api returns data:
{

"Total": 2021,
"List": [
    {
        "PlantCode": "F1331",
        "PlantName": "F1331",
        "UpdateDate": "2019/01/24",
        "UpdateUser": "Z12083050"
    }
]

} / / so that the data list will not be displayed

if queryData = List, the data list can be displayed normally, but there is no way to use server paging, or with st.reload, you can only override the search method.
@ cipchk Please take a look at it for me ~ Thank you ~

Apr.18,2022

you can learn about the [res] parameter. The structure of the response body is not the default [res] configuration item, so the data cannot be obtained.

should be an older version and should be a resReName parameter. https://ng-alain.github.io/1....

thanks to the resolution of @ cipchk , it is necessary to use the reName attribute to rename the responder structure (if the responder is different).
xxx.ts just add the following code.
res: STRes = {reName: {total: 'Total', list:' List'}};
Thank you again ~


refer to the comments of @ cipchk , @ ghwillbe , the data is displayed correctly when the page is initialized and loaded, but after I click the reset button, I get the data correctly again. When I click the page flip, the data is not submitted for the backstage,
reset button operation:
reset () {

// wait form reset updated finished
setTimeout(() => this.getData());

}

getData () {

this.http.post(url, this.form.value)
.subscribe((res: any) => {
  this.st.data = res.data;
  this.total = res.total;
  this.st.reload();
});

}

Please also @ cipchk , @ ghwillbe to help you see what to do, thank you!

Menu