Skip to content

Commit

Permalink
Added height prop to the table
Browse files Browse the repository at this point in the history
  • Loading branch information
BabyElias committed Aug 25, 2024
1 parent 0b1b1dc commit e014237
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/KTable/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<div ref="tableWrapper" class="k-table-wrapper">
<div ref="tableWrapper" class="k-table-wrapper" :style="tableWrapperStyle">
<table class="k-table" role="grid">
<caption v-if="caption">
{{ caption }}
Expand Down Expand Up @@ -144,6 +144,11 @@
if (header.width) style.width = header.width;
return style;
};
const tableWrapperStyle = computed(() => {
return {
height: props.height,
};
});
return {
sortKey,
Expand All @@ -155,6 +160,7 @@
SORT_ORDER_DESC,
DATA_TYPE_OTHERS,
getHeaderStyle,
tableWrapperStyle,
};
},
/* eslint-disable kolibri/vue-no-unused-properties */
Expand Down Expand Up @@ -201,6 +207,13 @@
type: Boolean,
default: true,
},
/**
* Sets the height of the table. Default is `auto`.
*/
height: {
type: String,
default: 'auto',
},
},
data() {
return {
Expand Down Expand Up @@ -473,7 +486,6 @@
.k-table-wrapper {
overflow: auto;
position: relative;
height:300px;
}
.k-table {
Expand Down

0 comments on commit e014237

Please sign in to comment.