Frontend Engineer
<template> <v-data-table class="fixed-column-table" :headers="tableHeader" :items="tableItems" item-key="id" fixed-header /> </template> <style lang="sass"> .fixed-column-table th:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid .fixed-column-table tr > td:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid .fixed-column-table tr > td white-space: nowrap max-width: 200px overflow: hidden text-overflow: ellipsis </style>
まずはfixed-headerを指定したv-data-tableを配置する。
それに対してthおよびtdの先頭要素をstickyにすることでカラムの位置が固定される。
.fixed-column-table th:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid .fixed-column-table tr > td:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid
最後にセルの中身を改行させないようにして完成
.fixed-column-table tr > td white-space: nowrap max-width: 200px overflow: hidden text-overflow: ellipsis
<template> <v-data-table class="fixed-column-table" :headers="tableHeader" :items="tableItems" item-key="id" fixed-header /> </template> <style lang="sass"> .fixed-column-table th:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid .fixed-column-table tr > td:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid .fixed-column-table tr > td white-space: nowrap max-width: 200px overflow: hidden text-overflow: ellipsis </style>
まずはfixed-headerを指定したv-data-tableを配置する。
それに対してthおよびtdの先頭要素をstickyにすることでカラムの位置が固定される。
.fixed-column-table th:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid .fixed-column-table tr > td:nth-child(1) position: sticky !important position: -webkit-sticky !important left: 0 z-index: 3 !important background: white border-right: 1px gray solid
最後にセルの中身を改行させないようにして完成
.fixed-column-table tr > td white-space: nowrap max-width: 200px overflow: hidden text-overflow: ellipsis