Implemented Frozen Rows
parent
211ed1ba5a
commit
b50286bca6
|
@ -60,6 +60,17 @@
|
|||
@cell-edit-init="onCellEditInit($event)" @cell-edit-complete="onCellEditComplete($event)" @cell-edit-cancel="onCellEditCancel($event)"
|
||||
@row-edit-init="onRowEditInit($event)" @row-edit-save="onRowEditSave($event)" @row-edit-cancel="onRowEditCancel($event)"/>
|
||||
</template>
|
||||
<template #frozenbody>
|
||||
<DTTableBody :value="frozenValue" :columns="columns" :dataKey="dataKey" :selection="selection" :selectionKeys="d_selectionKeys" :selectionMode="selectionMode"
|
||||
:rowGroupMode="rowGroupMode" :groupRowsBy="groupRowsBy" :expandableRowGroups="expandableRowGroups" :rowClass="rowClass" :editMode="editMode" :compareSelectionBy="compareSelectionBy"
|
||||
:expandedRowIcon="expandedRowIcon" :collapsedRowIcon="collapsedRowIcon" :expandedRows="expandedRows" :expandedRowKeys="d_expandedRowKeys" :expandedRowGroups="expandedRowGroups"
|
||||
:editingRows="editingRows" :editingRowKeys="d_editingRowKeys" :templates="$scopedSlots"
|
||||
@rowgroup-toggle="toggleRowGroup" @row-click="onRowClick($event)" @row-touchend="onRowTouchEnd" @row-keydown="onRowKeyDown"
|
||||
@row-mousedown="onRowMouseDown" @row-dragstart="onRowDragStart($event)" @row-dragover="onRowDragOver($event)" @row-dragleave="onRowDragLeave($event)" @row-dragend="onRowDragEnd($event)" @row-drop="onRowDrop($event)"
|
||||
@row-toggle="toggleRow($event)" @radio-change="toggleRowWithRadio($event)" @checkbox-change="toggleRowWithCheckbox($event)"
|
||||
@cell-edit-init="onCellEditInit($event)" @cell-edit-complete="onCellEditComplete($event)" @cell-edit-cancel="onCellEditCancel($event)"
|
||||
@row-edit-init="onRowEditInit($event)" @row-edit-save="onRowEditSave($event)" @row-edit-cancel="onRowEditCancel($event)"/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<DTTableFooter :columnGroup="footerColumnGroup" :columns="columns" />
|
||||
</template>
|
||||
|
@ -278,7 +289,11 @@ export default {
|
|||
scrollHeight: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
frozenValue: {
|
||||
type: Array,
|
||||
default: null
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<col v-for="(col,i) of columns" :key="col.columnKey||col.field||i" :style="col.headerStyle" />
|
||||
</colgroup>
|
||||
<slot name="header"></slot>
|
||||
<slot name="frozenbody"></slot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -20,14 +20,22 @@
|
|||
|
||||
<h3>Horizontal and Vertical</h3>
|
||||
<DataTable :value="cars" :scrollable="true" scrollHeight="200px" style="width: 600px">
|
||||
<Column field="vin" header="Vin" headerStyle="width: 250px"></Column>
|
||||
<Column field="year" header="Year" headerStyle="width: 250px"></Column>
|
||||
<Column field="brand" header="Brand" headerStyle="width: 250px"></Column>
|
||||
<Column field="color" header="Color" headerStyle="width: 250px"></Column>
|
||||
<Column field="vin" header="Vin" headerStyle="width: 250px"></Column>
|
||||
<Column field="year" header="Year" headerStyle="width: 250px"></Column>
|
||||
<Column field="brand" header="Brand" headerStyle="width: 250px"></Column>
|
||||
<Column field="color" header="Color" headerStyle="width: 250px"></Column>
|
||||
<Column field="vin" header="Vin" headerStyle="width: 250px" columnKey="vin_1"></Column>
|
||||
<Column field="year" header="Year" headerStyle="width: 250px" columnKey="year_1"></Column>
|
||||
<Column field="brand" header="Brand" headerStyle="width: 250px" columnKey="brand_1"></Column>
|
||||
<Column field="color" header="Color" headerStyle="width: 250px" columnKey="color_1"></Column>
|
||||
<Column field="vin" header="Vin" headerStyle="width: 250px" columnKey="vin_2"></Column>
|
||||
<Column field="year" header="Year" headerStyle="width: 250px" columnKey="year_2"></Column>
|
||||
<Column field="brand" header="Brand" headerStyle="width: 250px" columnKey="brand_2"></Column>
|
||||
<Column field="color" header="Color" headerStyle="width: 250px" columnKey="color_2"></Column>
|
||||
</DataTable>
|
||||
|
||||
<h3>Frozen Rows</h3>
|
||||
<DataTable :value="cars" :frozenValue="frozenCars" :scrollable="true" scrollHeight="200px">
|
||||
<Column field="vin" header="Vin"></Column>
|
||||
<Column field="year" header="Year"></Column>
|
||||
<Column field="brand" header="Brand"></Column>
|
||||
<Column field="color" header="Color"></Column>
|
||||
</DataTable>
|
||||
</div>
|
||||
|
||||
|
@ -55,7 +63,8 @@ import DataTableSubMenu from './DataTableSubMenu';
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
cars: null
|
||||
cars: null,
|
||||
frozenCars: null
|
||||
}
|
||||
},
|
||||
carService: null,
|
||||
|
@ -64,6 +73,11 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
this.carService.getCarsLarge().then(data => this.cars = data);
|
||||
|
||||
this.frozenCars = [
|
||||
{brand: "BMW", year: 2013, color: "Grey", vin: "fh2uf23"},
|
||||
{brand: "Chevrolet", year: 2011, color: "Black", vin: "4525g23"}
|
||||
];
|
||||
},
|
||||
components: {
|
||||
'DataTableSubMenu': DataTableSubMenu
|
||||
|
|
Loading…
Reference in New Issue