No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Trigger q-table refresh [solved]

    Help
    3
    5
    3340
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      star last edited by star

      I have q-table with data from server. When creating new record i want to refresh data from server. I don’t understand how to do this.

      T 1 Reply Last reply Reply Quote 0
      • T
        tof06 @star last edited by

        @star You can just call the method you use for @request property, with the current pagination and filter objects if you use them :

        // Attached to @request prop of q-table
        onRequest(prop) {
              const { page, rowsPerPage, sortBy, descending } = props.pagination
              const filter = props.filter
        // ...
        }
        
        onAddRecord() {
          // add the record
          // ...
          // Refresh
          this.onRequest({ filter: this.filter, pagination : this.pagination})
        }
        
        R 1 Reply Last reply Reply Quote 2
        • S
          star last edited by

          @tof06 Thank You! It works like a charm. I don’t know why I didn’t think of it.

          1 Reply Last reply Reply Quote 0
          • R
            Rusli Cali @tof06 last edited by

            @tof06 Do you have a fully sample code on this? Thanks!

            T 1 Reply Last reply Reply Quote 0
            • T
              tof06 @Rusli Cali last edited by

              @Rusli-Cali No I don’t.

              The full code would depend on a lot of stuff, how you are requesting data, if you are filtering or ordering them, how you are updating them…

              If you have any problem with my answer, post your code and I’ll try to help you.
              But basically, all you need is to call the @request event handler (which must be defined when you want to
              filter, order or paginate serverside) just after the new record has been created. This will fetch fresh data from the server, and update the table.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post