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

    <q-table> with a <q-fab> for 'Full screen' and 'Grid' selection ?

    Framework
    3
    7
    637
    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.
    • I
      Incremental last edited by Incremental

      Hello, I’m playing with the fantastic component <q-table> and have a question relating to the use of a <q-fab>

      As it is possible to call JS functions in <q-fab-action> with @click=“onClick”

      <q-fab-action
          color="accent"
          @click="onClick"
          icon="room"
          label="Grille"
      />
      

      would it be also possible to perform the same actions as the ones in the template :

                <!-- Full screen -->
                <q-btn
                  flat
                  round
                  dense
                  :icon="props.inFullscreen ? 'fullscreen_exit' : 'fullscreen'"
                  @click="props.toggleFullscreen"
                  v-if="mode === 'list'"
                >
                  <q-tooltip
                    :disable="$q.platform.is.mobile"
                    v-close-popup
                  >{{props.inFullscreen ? 'Exit Fullscreen' : 'Toggle Fullscreen'}}
                  </q-tooltip>
                </q-btn>
      
                <!-- Grid -->
                <q-btn
                  flat
                  round
                  dense
                  :icon="mode === 'grid' ? 'list' : 'grid_on'"
                  @click="mode = mode === 'grid' ? 'list' : 'grid'; separator = mode === 'grid' ? 'none' : 'horizontal'"
                  v-if="!props.inFullscreen"
                >
                  <q-tooltip
                    :disable="$q.platform.is.mobile"
                    v-close-popup
                  >{{mode==='grid' ? 'List' : 'Grid'}}
                  </q-tooltip>
                </q-btn>
      

      Thanks

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @Incremental last edited by

        @incremental said in <q-table> with a <q-fab> for 'Full screen' and 'Grid' selection ?:

        would it be also possible to perform the same actions as the ones in the template :

        Sorry I have no idea what you want.

        I 1 Reply Last reply Reply Quote 0
        • I
          Incremental @dobbel last edited by

          @dobbel
          I’ d like to move ‘Full screen’ and ‘Grid’ buttons in the <q-fab>

          d7ae446a-47ef-4009-8630-ad04544b8cd4-image.png

          metalsadman 1 Reply Last reply Reply Quote 0
          • metalsadman
            metalsadman @Incremental last edited by metalsadman

            @incremental you didn’t state where fab resides, is it in the same component as your q-table? when asking please provide more context, so peeps can help you more efficiently.

            I 1 Reply Last reply Reply Quote 0
            • I
              Incremental @metalsadman last edited by

              Sorry for the lack of details.
              Yes, the fab is in the same vue page.

              <template>
                <q-page class="q-pa-sm">
                  <q-card>
                    <q-table
                      title="Catégories"
                      :data="tabData"
                      :hide-header="mode === 'grid'"
                      :columns="tabColumns"
                      row-key="id"
                      :grid="mode=='grid'"
                      :filter="filter"
                    >
                      <template v-slot:top-right="props">
                        <!-- Search -->
                        <q-input
                          outlined
                          dense
                          debounce="300"
                          v-model="filter"
                          placeholder="Recherche"
                        >
                          <template v-slot:append>
                            <q-icon name="search" />
                          </template>
                        </q-input>
              
                        <!-- Table Full screen -->
                        <q-btn
                          flat
                          round
                          dense
                          :icon="props.inFullscreen ? 'fullscreen_exit' : 'fullscreen'"
                          @click="props.toggleFullscreen"
                          v-if="mode === 'list'"
                        >
                          <q-tooltip
                            :disable="$q.platform.is.mobile"
                            v-close-popup
                          >{{props.inFullscreen ? 'Exit Fullscreen' : 'Toggle Fullscreen'}}
                          </q-tooltip>
                        </q-btn>
                        <!-- Fin Full screen -->
              
                        <!-- Table Grid -->
                        <q-btn
                          flat
                          round
                          dense
                          :icon="mode === 'grid' ? 'list' : 'grid_on'"
                          @click="mode = mode === 'grid' ? 'list' : 'grid'; separator = mode === 'grid' ? 'none' : 'horizontal'"
                          v-if="!props.inFullscreen"
                        >
                          <q-tooltip
                            :disable="$q.platform.is.mobile"
                            v-close-popup
                          >{{mode==='grid' ? 'List' : 'Grid'}}
                          </q-tooltip>
                        </q-btn>
                        <!-- Fin Grid -->
              
                        <q-fab
                          v-model="fabActions"
                          vertical-actions-align="right"
                          label="Actions"
                          color="primary"
                          padding="xs"
                          glossy
                          icon="keyboard_arrow_down"
                          direction="down"
                        >
                          <!-- Add item -->
                          <q-fab-action
                            color="primary"
                            @click="addRow"
                            icon="add_circle"
                            label="Ajout"
                          />
                          <!-- Export CSV -->
                          <q-fab-action
                            color="secondary"
                            @click="exportTable"
                            icon="archive"
                            label="Export CSV"
                          />
                          <!-- Here I would like the Full screen and Grid buttons -->
                          <q-fab-action
                            color="orange"
                            @click="onClick"
                            icon="fullscreen"
                            label="Full Screen"
                          />
                          <q-fab-action
                            color="accent"
                            @click="onClick"
                            icon="grid_on"
                            label="Grid"
                          />
                        </q-fab>
                      </template>
              
              metalsadman 1 Reply Last reply Reply Quote 0
              • metalsadman
                metalsadman @Incremental last edited by metalsadman

                @incremental ok, so just do it the same as how the qbtns are doing it on the click event, since they are all in the same scope.

                1 Reply Last reply Reply Quote 0
                • I
                  Incremental last edited by

                  @metalsadman thanks I didn’t thought it was as simple as

                  <q-fab-action
                  	color="accent"
                  	@click="
                  		mode = mode === 'grid' ? 'list' : 'grid';
                  		separator = mode === 'grid' ? 'none' : 'horizontal';
                  	"
                  	:icon="mode === 'grid' ? 'list' : 'grid_on'"
                  	:label="mode === 'grid' ? 'List' : 'Grid'"
                  />
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post