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

    Pull to Refresh not working

    Help
    3
    6
    290
    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.
    • F
      felice last edited by

      I am trying to refresh my list of items using <q-pull-to-refresh> but when I pull the page down, it does not stop loading even though I have set the setTimeout to 1000. I want to refresh my list of items such that newly added items can be reflected in the list when refreshed. Is there any way I can solve this?

      Code:

      refresher (done) {
         setTimeout(() => {
           console.log("Refresh")
         }, 1000)
       } 
      
      1 Reply Last reply Reply Quote 0
      • O
        ouaR last edited by

        You have to call the “done” function.

        refresher (done) {
           setTimeout(() => {
             console.log("Refresh")
             done()
           }, 1000)
         } 
        
        F 2 Replies Last reply Reply Quote 0
        • F
          felice @ouaR last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • F
            felice @ouaR last edited by

            @ouaR Thank you for your reply! 🙂

            I would like to ask if there is a way I could reflect newly added items into the list when the page is pulled to refresh?
            I tried including my method getReminder() in the code but it does not work.

            I have a form that allows inputs into the database, and I am looking for a method to update the list of items (through pull to refresh) when new items are added.

            Code

            refresh (done) {
                    setTimeout(() => {
                      console.log("Refresh"),
                      this.getReminder(),
                      done()
                    }, 1000)
                  }
            
            J 1 Reply Last reply Reply Quote 0
            • J
              jadedRepublic @felice last edited by

              @felice said in Pull to Refresh not working:

              getReminder()

              Can you show the code for getReminder()? done() should be called when It’s when It’s finished running

              F 1 Reply Last reply Reply Quote 0
              • F
                felice @jadedRepublic last edited by

                @jadedRepublic here is the code for getReminder():

                methods: {
                   getReminder() {     
                           var documentClient = new AWS.DynamoDB.DocumentClient({apiVersion: "2012-08-10"});
                           var params = {
                             TableName: "schedule",
                             Select: "ALL_ATTRIBUTES"
                           };
                           if(this.credentials) {
                             documentClient.scan(params, (err, data) => {
                             if (err) {
                               console.error("Unable to read item. Error JSON:", JSON.stringify(err, null, 2));
                             } 
                             else {
                               for(var i in data) {
                                 scanResults.push([i, data[i]]);
                               }
                               reminderData = scanResults[0];
                               reminderData = reminderData[1];
                               reminderData.forEach((item) => {
                               let med_id = item.medicine_id;
                               let med_name = item.medicine_name;  
                               let med_frequency = item.medicine_frequency;
                               let med_prescription = item.doctor_prescription;
                               let med_time = item.medicine_time;
                               this.tableData.push({id: med_id, 
                                                        name: med_name, 
                                                        frequency: med_frequency,
                                                        prescription: med_prescription, 
                                                        time: med_time});
                          });
                        }
                     });
                   }
                   else {
                           var that = this;
                           var promise = AWS.config.credentials.getPromise();
                           promise.then(() => {
                               var creds = {
                                    ...
                               };
                     
                               that.credentials = creds;
                               documentClient.scan(params, (err, data) => {
                               if (err) {
                                 console.error("Unable to read item. Error JSON:", JSON.stringify(err, null, 2));
                               } 
                               else {
                                 for(var i in data) {
                                 scanResults.push([i, data[i]]);
                               }
                               reminderData = scanResults[0];
                               reminderData = reminderData[1];
                               reminderData.forEach((item) => {
                                  let med_id = item.medicine_id;
                                  let med_name = item.medicine_name;  
                                  let med_frequency = item.medicine_frequency;
                                  let med_prescription = item.doctor_prescription;
                                  let med_time = item.medicine_time;
                                  this.tableData.push({id: med_id, 
                                                          name: med_name, 
                                                          frequency: med_frequency, 
                                                          prescription: med_prescription, 
                                                          time: med_time});
                       });
                     }
                    });
                   },
                    function(err) {
                           that.credentials = null;
                        }
                      );
                  }
                
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post