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
    1. Home
    2. Marco
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 8
    • Best 2
    • Groups 0

    Marco

    @Marco

    2
    Reputation
    15
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Marco Follow

    Best posts made by Marco

    • RE: [Solved] [V1] Download a file in cordova app

      Solved using cordova-plugin-file.
      Replace:

      const url = window.URL.createObjectURL(new Blob([response.data]))
              const link = document.createElement('a')
              link.href = url
              link.setAttribute('download', fileName)
              document.body.appendChild(link)
              link.click()
      
      

      with:

       var blob = new Blob([response.data])
      
       if (typeof cordova !== 'undefined') {
           saveBlob2File(fileName, blob)
       }
      
      

      cordova file plugin code:

           function saveBlob2File (fileName, blob) {
              var folder = cordova.file.externalRootDirectory + 'Download'
              window.resolveLocalFileSystemURL(folder, function (dirEntry) {
                console.log('file system open: ' + dirEntry.name)
                createFile(dirEntry, fileName, blob)
              }, onErrorLoadFs)
            }
      
            function createFile (dirEntry, fileName, blob) {
              // Creates a new file
              dirEntry.getFile(fileName, { create: true, exclusive: false }, function (fileEntry) {
                writeFile(fileEntry, blob)
              }, onErrorCreateFile)
            }
      
            function writeFile (fileEntry, dataObj) {
              // Create a FileWriter object for our FileEntry
              fileEntry.createWriter(function (fileWriter) {
                fileWriter.onwriteend = function () {
                  console.log('Successful file write...')
                }
      
                fileWriter.onerror = function (error) {
                  console.log('Failed file write: ' + error)
                }
                fileWriter.write(dataObj)
              })
            }
      
            function onErrorLoadFs (error) {
              console.log(error)
            }
      
            function onErrorCreateFile (error) {
              console.log(error)
            }
      
      posted in Help
      M
      Marco
    • RE: [SOLVED] Newbie question: how to get a router reference?

      Thanks @metalsadman

      Now it works!
      My lack of understanding how next.router works.

      <script lang="ts">
      
      import { defineComponent } from 'vue'
      import { useRouter, useRoute } from 'vue-router'
      
      export default defineComponent({
        setup() {
      
          const router = useRouter()
          const route = useRoute()
      
          function onClick() {
              router.push({
              path: '/home'
            })     
          }
      
          return { onClick };
        }
        })
      </script>
      
      
      posted in Help
      M
      Marco

    Latest posts made by Marco

    • RE: [SOLVED] Newbie question: how to get a router reference?

      Thanks @metalsadman

      Now it works!
      My lack of understanding how next.router works.

      <script lang="ts">
      
      import { defineComponent } from 'vue'
      import { useRouter, useRoute } from 'vue-router'
      
      export default defineComponent({
        setup() {
      
          const router = useRouter()
          const route = useRoute()
      
          function onClick() {
              router.push({
              path: '/home'
            })     
          }
      
          return { onClick };
        }
        })
      </script>
      
      
      posted in Help
      M
      Marco
    • [SOLVED] Newbie question: how to get a router reference?

      How can I get a router reference inside a click handler ?

      <template>
        <div>
            <q-btn color="primary" label="Submit" @click="onClick" />
        </div>
      </template>
      
      <script lang="ts">
      
      export default {
          setup() {
      
          function onClick() {
              console.log('onClick'); 
              //router.replace({ path: '/home' })       
          }
      
          return { onClick };
        }
      }
      </script>
      
      posted in Help
      M
      Marco
    • RE: [Solved] [V1] Table sorting strange behaviour

      Thank you @s-molinari !

      posted in Framework
      M
      Marco
    • [Solved] [V1] Table sorting strange behaviour

      There is something strange about the ordering in the QTable examples in the documentation (V1)

      see Basic example

      It seems that by pressing on a column the sorting passes cyclically

      1. ascending
      2. descending
      3. not ordered

      It’s not what I expect.

      If I always click on the Calories column I expect:

      1. ascending
      2. descending
      3. ascending
      4. descending
      5. ascending
      6. descending
        …

      In the declaration of a column the sort field is defined as:
      function (a, b, rowA, rowB)
      Why not add a descending parameter (true / false)?

      The only example in the QTable documentation that behaves as I expect is the Custom sorting

      Did I miss something?

      posted in Framework
      M
      Marco
    • RE: [Solved] [V1] Download a file in cordova app

      Solved using cordova-plugin-file.
      Replace:

      const url = window.URL.createObjectURL(new Blob([response.data]))
              const link = document.createElement('a')
              link.href = url
              link.setAttribute('download', fileName)
              document.body.appendChild(link)
              link.click()
      
      

      with:

       var blob = new Blob([response.data])
      
       if (typeof cordova !== 'undefined') {
           saveBlob2File(fileName, blob)
       }
      
      

      cordova file plugin code:

           function saveBlob2File (fileName, blob) {
              var folder = cordova.file.externalRootDirectory + 'Download'
              window.resolveLocalFileSystemURL(folder, function (dirEntry) {
                console.log('file system open: ' + dirEntry.name)
                createFile(dirEntry, fileName, blob)
              }, onErrorLoadFs)
            }
      
            function createFile (dirEntry, fileName, blob) {
              // Creates a new file
              dirEntry.getFile(fileName, { create: true, exclusive: false }, function (fileEntry) {
                writeFile(fileEntry, blob)
              }, onErrorCreateFile)
            }
      
            function writeFile (fileEntry, dataObj) {
              // Create a FileWriter object for our FileEntry
              fileEntry.createWriter(function (fileWriter) {
                fileWriter.onwriteend = function () {
                  console.log('Successful file write...')
                }
      
                fileWriter.onerror = function (error) {
                  console.log('Failed file write: ' + error)
                }
                fileWriter.write(dataObj)
              })
            }
      
            function onErrorLoadFs (error) {
              console.log(error)
            }
      
            function onErrorCreateFile (error) {
              console.log(error)
            }
      
      posted in Help
      M
      Marco
    • [Solved] [V1] Download a file in cordova app

      Hi all,
      my spa application download a file with the code below:

      this.$axios.post('/api/v1', { url: url, retType: 'excel' },
              { responseType: 'blob' }).then(function (response) {
              const url = window.URL.createObjectURL(new Blob([response.data]))
              const link = document.createElement('a')
              link.href = url
              link.setAttribute('download', fileName)
              document.body.appendChild(link)
              link.click()
              $q.loading.hide()
            }).catch(function (/* error */) {
              $q.loading.hide()
            })
      

      It works fine even in chrome on my android phone (pie).
      I built the android cordova app; it works but when I press the button to download the file it silently fails.
      Do you think the problem is some permission missed on the manifest or do I need to use a cordova plugin ?

      Is this the problem?

      window.URL.createObjectURL()
      

      Thanks

      posted in Help
      M
      Marco
    • RE: [Solved] How can I configure rest api params (server:port) in my electron app?

      Thank you mKomo, it works!
      I’m just a newbie.

      posted in Help
      M
      Marco
    • [Solved] How can I configure rest api params (server:port) in my electron app?

      Hello guys,

      I’m struggling with my first electron app.

      A button triggers a rest api call:

      this.$axios.post(’/api/v1’, …

      It fails (Network Error) …

      Where do I configure my app to use the real url?:
      http://<server>:<port>/api/v1

      I have had no problems with the spa version.

      Thanks

      posted in Help
      M
      Marco