Search code examples
vue.jsvuetify.jsv-selectv-data-table

How can i convert v-data-table to v-select in vuetify?


I already have a v-data-table of vuetify and i want to convert its contents from a data table to a drop down using v-select. How is it possible to do the change?

                      <v-data-table
                      dense
                      v-if="requester_details.credential_type == 'TEMPLATE'"
                      class="elevation-0"
                      hide-default-footer
                      :headers="templateResultHeaders"
                      @click:row="handleRowClickTemplate"
                      :items="GetAllTemplatesList"
                      :no-data-text="noDataText"
                      >
                      <template v-slot:[`item.template_name`]="{ item }">
                        <div>{{ item.template_name }}</div>
                      </template>
                      <template v-slot:[`item.Action`]="{}">
                        <v-icon color="primary">mdi-chevron-right</v-icon>
                      </template>
                    </v-data-table>

Solution

  • Well did this and it works as expected. Writing "return object" is important to open the content of the v-select fields

        <v-select
      v-if="requester_details.credential_type == 'TEMPLATE'"
      class="FontSize field_height field_label_size"
      dense
      placeholder="Template items"
      outlined
      :items="GetAllTemplatesList"
      item-text="template_name"
      @change="handleRowClickTemplate"
      return-object
    >
    </v-select>