Code Monkey home page Code Monkey logo

Comments (8)

HC200ok avatar HC200ok commented on May 27, 2024 1

@sdezza I am afraid that you didn't use the loading data when requesting new data from the server,
please try this:

methods: {
      async getCalls(){
	this.loading = true; // add this
        await axios
          .get(`/api/calls/?page=${this.serverOptions.page}`)
          .then(response => {
            this.items = response.data.results
            this.serverItemsLength = response.data.count
	    this.loading = false // add this
          })
          .catch(error => {
            console.log(error);
          })
      },
    },

from vue3-easy-data-table.

HC200ok avatar HC200ok commented on May 27, 2024

@sdezza According to your response, If the second page is not the last page, It seems that your API is responding two rows for each page, so I think you should set the rowsPerPage in serverOptions to 2.

from vue3-easy-data-table.

sdezza avatar sdezza commented on May 27, 2024

Actually, It was an example of my response, in reality I have 10 items per page. But even changing rowsPerPage to 10 doesn't solve the problem

from vue3-easy-data-table.

HC200ok avatar HC200ok commented on May 27, 2024

@sdezza can you describe

the next pages are no more loaded

more detailedly? is the pagination button unavailable or the serverOptions doesn't update?

from vue3-easy-data-table.

HC200ok avatar HC200ok commented on May 27, 2024

@sdezza

watch: {
      serverOptions(value) {
        this.serverOptions.page = value.page
        this.getCalls()
      },
    },

this.serverOptions.page = value.page

↑doesn't seem to be necessary, and since you are watching an object variable (serverOptions),
It is better to use a deep watcher.

watch: {
  serverOptions: {
    handler(value) {
      this.getCalls();
    },
    deep: true,
  }
},

from vue3-easy-data-table.

sdezza avatar sdezza commented on May 27, 2024

Thanks for the tips with deep watcher, I have updated my code (still with the same problem)

Here is the problem Flow:

  • 1 Page is loaded wich is ok
  • On click "Next", second page is loaded, which is also ok
    image
  • On click "Next" Again, Page 2 is always loaded instead of Page 3,4,5,.....
    image

I really don't see where the problem comes from :/

from vue3-easy-data-table.

sdezza avatar sdezza commented on May 27, 2024

Works!! πŸ‘
I thought this.loading was just handling the css loader...
Thanks for your support and this package

from vue3-easy-data-table.

HC200ok avatar HC200ok commented on May 27, 2024

@sdezza It will become very confusing when forgetting to use loading, and I will solve this problem in the future version, thank you for reporting.

from vue3-easy-data-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.