mercredi 27 septembre 2017

How to display a loading screen after form.submit() in ember js

Please consider: - a loading.hbs file exist, which gets called by ember when transaction occurs. - Used form.submit() approach to retrieve data from the server in the Ember framework. I didn't use this.store.findrecord() because we faced some issue in downloading a file (created in the server) as an attachment and so went with the form.submit() approach.

Objective: - a loading screen should get displayed when the form.submit() is triggered until we get the final data from the server.

Problem: - In ember, when we go for this.store.findall() approach, ember automatically search for a file like loading.hbs and it displays the file until the full data is downloaded from the server. - Since we are going via form.submit() approach, the ember is not searching for loading.hbs file to display.

Is there anyway, to display the loading.hbs file when the form.submit() is triggered.

Here is my code:

actions: {
    pdfClick(Id) {
      pdfId=document.getElementById("version_"+Id).value;
      let form = document.getElementById("pdfForm");
      form.action = Globals.urlPrefix + this.get('router.url') + "/" + Id; //This line creates the URL to be triggered
      form.submit();
      form.action = "";
    }
}




Aucun commentaire:

Enregistrer un commentaire