How to update the content from table using backend and pagenumber
How to update the content from table using backend and pagenumber
Goal:
Use page number in order to retrieve fresh data from backend and then display it at frontend..
``
Problem:
I was enable to retrieve data from backend with pagenumber as a parameter but it doesn't show it in the list. What part of the code, front end code, am I missing?
Jsbin:
https://jsbin.com/yaroliqoyu/edit?js,console,output
.net fiddle
https://dotnetfiddle.net/p4wsTs
https://dotnetfiddle.net/70ovcc
Info:
*Primary use client mode if possible.
*Using .net core webapi (framework 5 for .net core) as a backend
*The backend is a simplified sample.
*Using Datatable for frontend with jquery.
*The total row is less than 50 000 row
Thank you!
Answers
I'm not sure what you mean I'm afraid. In the Ajax request that is made to
https://localhost:44340/api/Tests/SimpleGetAllPostsByPagenumber?pagenumber=" + ab
I can see thestart
andlength
parameters being given to it:Btw:
dataSrc: ""
won't work with server-side processing since the server must respond with an object.Allan
Thank you for your help!
1.
How do you find out the data for start=0&length=10?
Do you need to use chrome dev tool or something else?
2.
"https://datatables.net/manual/server-side#Sent-parameters"
How should I write the URL code in order to retrieve new data based on selected pagenumber?
What parameter data do I need to send it to backend webapi?
Thank you!
I used the browser's inspector tools and looked at the Ajax request that the table is making. All of the parameters are documented in the link you give above.
If you are using WebAPI and don't want to write your own implementation of server-side processing, consider using our .NET libraries.
Allan