javascriptextjs6-modern

Save As Dialog in Ext Js



I want to ask if there is a "Save As" dialog in Ext Js Modern? So I can save an Object from a web Page into a local file.


Solution

  • Another solution depends on the Portlet Concept:

    1. in ViewController you fire an event ex "downloadFile"
    2. in Main Controller you catch the event and execute a function "downloadFile" and call a function in let it the same name
    3. AjaxController (Ext.app.Controller) you call the function doStandardSubmit

      location.href = this.url + '&operation=download&param1=' + param1val;

    4. in the Backend of the portlet (Java) you write the endPOint method :

      @EndpointMethod(encode = false) public void download(DataAccessor dataAccessor, AuthenticationGenerationConfiguration configuration, @RequestKey String param1, ResourceResponse response) throws IOException {

      OutputStream outputStream = response.getPortletOutputStream(); try {

                  // Adjusting content type
                  response.setContentType("text/plain");
                  response.setProperty("Content-Disposition", "attachment; filename=\"" + FILENAME + "\"");
                      outputStream.flush();
              } finally {
                  outputStream.close();
              }
          }