-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pager missing #576
Comments
Problem solved。 After debuged the source code. I found the reason which made the pager missing. 1.pager.display is not the only parameter can effect the pager shown. 4.fix way: Adding the "total:xxx" data in your response json, AND setting totalKey in your serverDataSource like this: PS: Please forgive my poor english grammra,I'm chinese,english is not my mother language. |
Hello budy, how are you? Additionally, I have seen that it is necessary to return via the response header x-total-count. But it still does not work. My ServerDataSource is as follows:
|
Hello @souzaemmanuel , If it still not working... please debug the source code which I mentioned(server.data-source.js),I think the problem is still in the extractTotalFromResponse() function. I dont know if there are some fixs these 2 month. So you should debug your version source code. Good luck. |
Hey man, finally I got it! Just passing the total through into the header.
Thanks for the help. |
Hey @souzaemmanuel ,I'm glad to hear your code is working. You are Welcome. |
Hi am new to angular 2? Am also having the same issue.when i load the data from server ,the pager is not working,it will loads the entire data to my browser,can u show me the working code snippet for server.data-source.js |
Hi @PrasanthBaski. I didn't change server.data-source.js code.I just debug into it. Maybe you should try it. |
Hi@starpipi Stack trace: |
Hi @PrasanthBaski Is your response json data object is an array? I wander what's in your data object. |
Hi @starpipi below is the json am getting from rest service,As of now what's my problem is ,i didnot get pager ,instead of it it loads the entire data to my browser from the server |
{ |
Hi @PrasanthBaski ,I'm sorry I didn't check out my email these two days. After I debug and change the setting, I also add the 'total' count into my response json just like this blow: |
Hi @starpipi ,can you please tell me where i need to set the total count ,In which file i need to modify the code??.Am sitting in this issue for more a week. |
Hi @PrasanthBaski ,forgive my poor english. total count setting just in ServerDataSource like this: totalKey is your setting. this setting will automatically setting your total as the value you response returned。 |
i have the same problem when i use server data source, i don't get pager i get all my data into one page @starpipi |
请问 api的token 怎么设置在线等 |
toek n |
@starpipi HIHI, I also got the same problem The error was :
The server response was : The error showed that it could not get my data. But my dataKey of config was right, and it was a array . |
Hi @jyzbamboo ,I'm so sorry about replying so late. In your code ,the error shows it can't get data by your config. but your config shows was right.I'm aggree with your opinion. I'm so sorry I can't help you fix this problem. I have no envirement in my computer,so i can't recreate your problem. |
Hi, I had the same issue and after spending more than 2 days, here is the summary of what I learned. Like @starpipi said, the reason pager is not shown is probably because ServerDataSource class was not able to find the 'total' header in the response headers for the particular get request you want the pagination working for. You can check if your server is sending you this header in the Chrome dev tools in the request headers section. You can find it in the image. Initially I did not find this in the header and later after some research discovered that Loopback does not support this out of the box. I followed an article for implementing pagination in Loopback 3. I used the script from that and got the header working. Now I could see the header in the Chrome dev tools but still was not able to access these headers and neither was the Pager showing up. Later, I discovered that you need to expose custom headers from the server in order to get access them in the frontend. Based on this Stackoverflow question, you need to expose the custom headerin cors config. Like shown in the image Hope this helps someone in the future, since I spent several hours in debugging this issue. |
There is a function extractDataFromResponse in the ng2-smart-table library, there change res.data to res.json() |
I am using the ServerDataSource to query data from server.
Data shows ok,but the PAGER is missing.
I tried config the pager in settings
like
settings:{
pager:{
display:true,
perPage:2
}
}
but still not working.
The template binding shows "ng-reflect-ng-if": "false".
It seems nobody got this problem.
Does anyone know what I'm missing?
The text was updated successfully, but these errors were encountered: