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. mendesgeo
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 6
    • Best 2
    • Groups 0

    Matheus Eduardo Garbelini

    @mendesgeo

    2
    Reputation
    528
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Email mgarbelix@gmail.com Location Brazil

    mendesgeo Follow

    Best posts made by mendesgeo

    • RE: Context menu in treeList

      THANK YOU VERY MUCH!!!

      @spectrolite, by implementing what you suggested, everything worked and in a very clean way.
      Also, fortunatelly my IOT esp8266 device happly loaded very fast a Quasar page in such small device.
      Its very difficult to me as an electronic engineering student to understand how everything works (Nodejs/NPM + Quasar + ESLint + ES6 + Babel + NWJS), the web world is so huge nowaday, so I will try to explain well what I did to get Tree + Context menu.

      • Created a DIV and put Tree element and de context menu as its child. Also added the context menu handler:
      <div @contextmenu="rightClickHandler($event)">
      
      • Next, I poppulated Tree model data with the same as seen in quasar docs.

      • In the context menu tag I put a :V-SHOW property linked to a variable named enableContextMenu :

      <q-context-menu v-show="enableContextMenu" ref="context">
      
      • Inside context menu, I put an item that its label is linked to the posterior Tree element that is clicked:
      <q-item>
          <q-item-main :label="itemName"/>
      </q-item>
      
      • In the end, the right click event handler is implemented so when the clicked element have a <SPAN> tagName, the handler selects its innerHTML (element name) and enables the context menu to be shown by the enableContextMenu variable:
      methods: {
           rightClickHandler: function(e) {
              e.preventDefault();
              if(e.target.tagName == 'SPAN')
              {
              this.itemName = e.target.innerHTML;
              this.enableContextMenu=true;
              }
               else
               {
                   this.enableContextMenu=false;             
               }
           }
        }
      

      Here’s the complete code

      <template>
        <q-layout
          ref="layout"
          view="lHh Lpr fff"
          :left-class="{'bg-grey-2': true}"
        >
          <q-toolbar slot="header" class="flat">
            <q-toolbar-title>
              Quasar App
              <div slot="subtitle">Running on Quasar v{{$q.version}}</div>
            </q-toolbar-title>
          </q-toolbar>
      
            <div @contextmenu="rightClickHandler($event)">
             <q-tree
              :model="treeModel"
              contract-html="<i class='material-icons'>remove_circle</i>"
              expand-html="<i class='material-icons'>add_circle</i>"
            />
                <q-context-menu v-show="enableContextMenu" ref="context">
                <q-list link separator no-border style="min-width: 150px; max-height: 300px;"
                @click="$refs.context.close()">
                  <q-item>
                    <q-item-main :label="itemName"/>
                  </q-item>
                </q-list>
              </q-context-menu>
            </div>
        </q-layout>
      </template>
      
      <script>
      import {
        dom,
        event,
        openURL,
        QLayout,
        QToolbar,
        Toast,
        QContextMenu,
        QToolbarTitle,
        QTree,
        QBtn,
        QIcon,
        QList,
        QListHeader,
        QItem,
        QItemSide,
        QItemMain
      } from 'quasar'
      
      
      export default {
        name: 'index',
        components: {
          QLayout,
          QTree,
          QToolbar,
          QContextMenu,
          QToolbarTitle,
          QBtn,
          QIcon,
          QList,
          QListHeader,
          QItem,
          QItemSide,
          QItemMain
        },
        data () {
          return {
              enableContextMenu:false,
              itemName: "",
              treeModel: [
              {
                title: 'Item 1',
                expanded: true,
                icon: 'alarm',
                children: [
                  {
                    title: 'Item 1.1',
                    expanded: false,
                    children: [
                      {
                        title: 'Item 1.1.1',
                        expanded: false,
                        children: [
                          {
                            title: 'Item 1.1.1.1',
                            expanded: false,
                            children: []
                          }
                        ]
                      },
                      {
                        title: 'Item 1.1.2',
                        expanded: false,
                        children: []
                      }
                    ]
                  },
                  {
                    title: 'Item 1.2',
                    expanded: false,
                    children: []
                  },
                  {
                    title: 'Item 1.3',
                    expanded: false,
                    handler () {
                      Toast.create('Tapped on item 1.3')
                    },
                    children: []
                  }
                ]
              },
              {
                title: 'Item 2',
                expanded: false,
                children: [
                  {
                    title: 'Item 2.1',
                    expanded: false,
                    children: [
                      {
                        title: 'Item 2.1.1',
                        expanded: false,
                        children: []
                      },
                      {
                        title: 'Item 2.1.2',
                        expanded: false,
                        children: [
                          {
                            title: 'Item 2.1.2.1',
                            expanded: false,
                            children: []
                          },
                          {
                            title: 'Item 2.1.2.2',
                            expanded: false,
                            children: []
                          }
                        ]
                      }
                    ]
                  },
                  {
                    title: 'Item 2.2',
                    expanded: false,
                    children: []
                  },
                  {
                    title: 'Item 2.3',
                    expanded: false,
                    children: []
                  }
                ]
              }
            ]
          }
        },
        methods: {
           rightClickHandler: function(e) {
              e.preventDefault();
              if(e.target.tagName == 'SPAN')
              {
              this.itemName = e.target.innerHTML;
              this.enableContextMenu=true;
              }
               else
               {
                   this.enableContextMenu=false;             
               }
           }
        }
      }
      </script>
      
      
      posted in Framework
      mendesgeo
      mendesgeo
    • RE: Context menu in treeList

      @spectrolite @a47ae yes, indeed all I need is to reduce the number of requests. Everything seems OK now. Soon I will upload the project with the github link. Thank for all your help. Tested quasar on NWJS too, it has shown to be very responsive.
      Hehehe, seem like I’m using cheating now that I can make interactive user interfaces for my electronic projects, most electronic enginners don’t bother making a beautiful interface and stick to initially ugly non webs interfaces like C# WinFoms, Qt, etc. The future is Web and NodeJS. 👍

      posted in Framework
      mendesgeo
      mendesgeo

    Latest posts made by mendesgeo

    • RE: Quasar v0.14.1 released.

      Oh my god, I just deployed my webserver to test those new features.
      In my opinion quasar is the best and easiest web framework nowadays, I took Quasar 0.13.9 Starter Kit with JWT Authentication and updated it to 14.1. I Also used Loopback server framework for the backend (instead of laravel). Anyone interested to check it out, here’s the link:
      http://ec2-54-237-40-190.compute-1.amazonaws.com

      posted in Announcements
      mendesgeo
      mendesgeo
    • RE: Context menu in treeList

      @spectrolite @a47ae yes, indeed all I need is to reduce the number of requests. Everything seems OK now. Soon I will upload the project with the github link. Thank for all your help. Tested quasar on NWJS too, it has shown to be very responsive.
      Hehehe, seem like I’m using cheating now that I can make interactive user interfaces for my electronic projects, most electronic enginners don’t bother making a beautiful interface and stick to initially ugly non webs interfaces like C# WinFoms, Qt, etc. The future is Web and NodeJS. 👍

      posted in Framework
      mendesgeo
      mendesgeo
    • RE: Context menu in treeList

      @spectrolite Thank you again, by doing so and increasing the default maximum size of fonts files, the loader inlined everything.

      posted in Framework
      mendesgeo
      mendesgeo
    • RE: Context menu in treeList

      @a47ae and @spectrolite thanks for tour reply. I’m glad that you guys seems surprised with quasar in esp8266. For now i just runned the default quasar sample page in esp8266. I just had to modify some webpack configuration so the bundled files name are kept with a shortname that esp8266 can handle in its file system.

      Soon i will post the project so everyone can try it out in a esp8266 device.

      PS: I’m studing webpack so i can see if its possible to generate a single file only in production build. It would decrease a lot more esp8266 requests when loading a page.

      posted in Framework
      mendesgeo
      mendesgeo
    • RE: Context menu in treeList

      THANK YOU VERY MUCH!!!

      @spectrolite, by implementing what you suggested, everything worked and in a very clean way.
      Also, fortunatelly my IOT esp8266 device happly loaded very fast a Quasar page in such small device.
      Its very difficult to me as an electronic engineering student to understand how everything works (Nodejs/NPM + Quasar + ESLint + ES6 + Babel + NWJS), the web world is so huge nowaday, so I will try to explain well what I did to get Tree + Context menu.

      • Created a DIV and put Tree element and de context menu as its child. Also added the context menu handler:
      <div @contextmenu="rightClickHandler($event)">
      
      • Next, I poppulated Tree model data with the same as seen in quasar docs.

      • In the context menu tag I put a :V-SHOW property linked to a variable named enableContextMenu :

      <q-context-menu v-show="enableContextMenu" ref="context">
      
      • Inside context menu, I put an item that its label is linked to the posterior Tree element that is clicked:
      <q-item>
          <q-item-main :label="itemName"/>
      </q-item>
      
      • In the end, the right click event handler is implemented so when the clicked element have a <SPAN> tagName, the handler selects its innerHTML (element name) and enables the context menu to be shown by the enableContextMenu variable:
      methods: {
           rightClickHandler: function(e) {
              e.preventDefault();
              if(e.target.tagName == 'SPAN')
              {
              this.itemName = e.target.innerHTML;
              this.enableContextMenu=true;
              }
               else
               {
                   this.enableContextMenu=false;             
               }
           }
        }
      

      Here’s the complete code

      <template>
        <q-layout
          ref="layout"
          view="lHh Lpr fff"
          :left-class="{'bg-grey-2': true}"
        >
          <q-toolbar slot="header" class="flat">
            <q-toolbar-title>
              Quasar App
              <div slot="subtitle">Running on Quasar v{{$q.version}}</div>
            </q-toolbar-title>
          </q-toolbar>
      
            <div @contextmenu="rightClickHandler($event)">
             <q-tree
              :model="treeModel"
              contract-html="<i class='material-icons'>remove_circle</i>"
              expand-html="<i class='material-icons'>add_circle</i>"
            />
                <q-context-menu v-show="enableContextMenu" ref="context">
                <q-list link separator no-border style="min-width: 150px; max-height: 300px;"
                @click="$refs.context.close()">
                  <q-item>
                    <q-item-main :label="itemName"/>
                  </q-item>
                </q-list>
              </q-context-menu>
            </div>
        </q-layout>
      </template>
      
      <script>
      import {
        dom,
        event,
        openURL,
        QLayout,
        QToolbar,
        Toast,
        QContextMenu,
        QToolbarTitle,
        QTree,
        QBtn,
        QIcon,
        QList,
        QListHeader,
        QItem,
        QItemSide,
        QItemMain
      } from 'quasar'
      
      
      export default {
        name: 'index',
        components: {
          QLayout,
          QTree,
          QToolbar,
          QContextMenu,
          QToolbarTitle,
          QBtn,
          QIcon,
          QList,
          QListHeader,
          QItem,
          QItemSide,
          QItemMain
        },
        data () {
          return {
              enableContextMenu:false,
              itemName: "",
              treeModel: [
              {
                title: 'Item 1',
                expanded: true,
                icon: 'alarm',
                children: [
                  {
                    title: 'Item 1.1',
                    expanded: false,
                    children: [
                      {
                        title: 'Item 1.1.1',
                        expanded: false,
                        children: [
                          {
                            title: 'Item 1.1.1.1',
                            expanded: false,
                            children: []
                          }
                        ]
                      },
                      {
                        title: 'Item 1.1.2',
                        expanded: false,
                        children: []
                      }
                    ]
                  },
                  {
                    title: 'Item 1.2',
                    expanded: false,
                    children: []
                  },
                  {
                    title: 'Item 1.3',
                    expanded: false,
                    handler () {
                      Toast.create('Tapped on item 1.3')
                    },
                    children: []
                  }
                ]
              },
              {
                title: 'Item 2',
                expanded: false,
                children: [
                  {
                    title: 'Item 2.1',
                    expanded: false,
                    children: [
                      {
                        title: 'Item 2.1.1',
                        expanded: false,
                        children: []
                      },
                      {
                        title: 'Item 2.1.2',
                        expanded: false,
                        children: [
                          {
                            title: 'Item 2.1.2.1',
                            expanded: false,
                            children: []
                          },
                          {
                            title: 'Item 2.1.2.2',
                            expanded: false,
                            children: []
                          }
                        ]
                      }
                    ]
                  },
                  {
                    title: 'Item 2.2',
                    expanded: false,
                    children: []
                  },
                  {
                    title: 'Item 2.3',
                    expanded: false,
                    children: []
                  }
                ]
              }
            ]
          }
        },
        methods: {
           rightClickHandler: function(e) {
              e.preventDefault();
              if(e.target.tagName == 'SPAN')
              {
              this.itemName = e.target.innerHTML;
              this.enableContextMenu=true;
              }
               else
               {
                   this.enableContextMenu=false;             
               }
           }
        }
      }
      </script>
      
      
      posted in Framework
      mendesgeo
      mendesgeo
    • Context menu in treeList

      Hello I was tryng to add a context menu with the TreeList so i can show some options to the user. The problem is that i don’t know how to get the right click source element.

      Is there a way to expose the child element that the context menu was opened above?

      posted in Framework
      mendesgeo
      mendesgeo