1

Is there a way to sort a v-data-table by the selection column? I would like to multisort my v-data-table. First by selection, so the selected ones are always on top and second by name. So far I got this:

 <template>
  <v-app>
    <div id="app">
      <v-data-table
        :headers="tableHeaders"
        :items="selectables"
        :show-select="true"
        :sort-by="['isSelected', 'name']"
        multi-sort
        v-model="output"
        return-object
      >
      </v-data-table>
    </div>
  </v-app>
</template>

<script>
export default {
  data() {
    return {
      output: {},
      tableHeaders: [
        {
          text: "name",
          value: "name",
        },
      ],
      selectables: [
        {
          name: "toni",
        },
        {
          name: "hans",
        },
        {
          name: "fritz",
        },
      ],
    };
  },
};
</script>
4

0 回答 0