How to update the content from table using backend and pagenumber

How to update the content from table using backend and pagenumber

jt4000jt4000 Posts: 7Questions: 4Answers: 0

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

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    but it doesn't show it in the list.

    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 the start and length parameters being given to it:

    start=0&length=10

    Btw: dataSrc: "" won't work with server-side processing since the server must respond with an object.

    Allan

  • jt4000jt4000 Posts: 7Questions: 4Answers: 0
    edited August 2021

    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!

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    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.

    How should I write the URL code in order to retrieve new data based on selected pagenumber?

    If you are using WebAPI and don't want to write your own implementation of server-side processing, consider using our .NET libraries.

    Allan

Sign In or Register to comment.