diff --git a/docs/pages/ktable.vue b/docs/pages/ktable.vue
index b2e28580f..38878bea8 100644
--- a/docs/pages/ktable.vue
+++ b/docs/pages/ktable.vue
@@ -17,7 +17,7 @@
Table without sorting functionality
- This is an example to show how KTable
can be used without any sorting functionality, as a simple table. Use of slots is optional.
+ This is an example to show how KTable
can be used without any sorting functionality, as a simple table.
@@ -25,16 +25,7 @@
:headers="headers"
:rows="rows"
caption="Non Sortable Table"
- >
-
-
- { header.label } (Backend)
-
-
- { content } (City)
- { content }
-
-
+ />
@@ -47,7 +38,7 @@
{ label: 'City', dataType: 'string' },
],
rows: [
- ['John Doe', 28, 'New York'],
+ ['John Doe', 28, 'New York'],
['Jane Smith', 34, 'Los Angeles'],
['Samuel Green', 22, 'Chicago'],
['Alice Johnson', 30, 'Houston'],
@@ -63,15 +54,7 @@
:headers="headers"
:rows="rows"
caption="Non-sortable table"
- >
-
- {{ header.label }} (Backend)
-
-
- {{ content }} (City)
- {{ content }}
-
-
+ />
@@ -99,7 +82,7 @@
{ label: 'City', dataType: 'string' },
],
rows: [
- ['John Doe', 28, 'New York'],
+ ['John Doe', 28, 'New York'],
['Jane Smith', 34, 'Los Angeles'],
['Samuel Green', 22, 'Chicago'],
['Alice Johnson', 30, 'Houston'],
@@ -113,11 +96,119 @@
+
+ Table showing use of slots
+
+ This is an example to show how slots can be used in KTable
. The table currently provides slots for header
and cell
which can be used to customize the table header and cell content respectively.
+
+
+
+
+
+ { header.label } (Local)
+
+
+ { content } years old
+ Test
+ { content }
+
+
+
+
+
+
+ data() {
+ return {
+ slotHeaders: [
+ { label: 'Name', dataType: 'string' },
+ { label: 'Age', dataType: 'number' },
+ { label: 'City', dataType: 'string' },
+ { label: 'Joined', dataType: 'date' },
+ { label: 'Misc', dataType: 'undefined' },
+ ],
+ slotRows: [
+ ['John Doe', 28, 'New York', '2022-01-15T00:00:00Z', 'N/A'],
+ ['Jane Smith', 34, 'Los Angeles', '2021-12-22T00:00:00Z', 'N/A'],
+ ['Samuel Green', 22, 'Chicago', '2023-03-10T00:00:00Z', 'N/A'],
+ ['Alice Johnson', 30, 'Houston', '2020-07-18T00:00:00Z', 'N/A'],
+ ],
+ };
+ },
+
+
+
+
+
+ {{ header.label }} (Local)
+
+
+ {{ content }} years old
+ Test
+ {{ content }}
+
+
+
+
+
+ Table with custom column widths
+
+ This is an example to show how KTable
can be used with custom column widths. The column widths are defined in the headers
prop. The width
property is used to define the overall width of the column. The minWidth
defines the minimum width of column, below which the column will not shrink.
+
+
+
+
+
+
+
+
+ data() {
+ return {
+ headersWithCustomWidths: [
+ { label: 'Name', dataType: 'string', minWidth: '20px', width: '2%' },
+ { label: 'Age', dataType: 'number', minWidth: '100px', width: '33%' },
+ { label: 'City', dataType: 'string', minWidth: '200px', width: '25%' },
+ { label: 'Joined', dataType: 'date', minWidth: '150px', width: '20%' },
+ { label: 'Misc', dataType: 'undefined', minWidth: '100px', width: '20%' },
+ ],
+ customRows: [
+ ['John Doe', 28, 'New York', '2022-01-15T00:00:00Z', 'N/A'],
+ ['Jane Smith', 34, 'Los Angeles', '2021-12-22T00:00:00Z', 'N/A'],
+ ['Samuel Green', 22, 'Chicago', '2023-03-10T00:00:00Z', 'N/A'],
+ ['Alice Johnson', 30, 'Houston', '2020-07-18T00:00:00Z', 'N/A'],
+ ],
+ };
+ },
+
+
+
+
+
+
@@ -146,6 +237,32 @@
['Michael Brown', 45, 'Phoenix'],
['Emily Davis', 27, 'Philadelphia'],
],
+ slotHeaders: [
+ { label: 'Name', dataType: 'string' },
+ { label: 'Age', dataType: 'number' },
+ { label: 'City', dataType: 'string' },
+ { label: 'Joined', dataType: 'date' },
+ { label: 'Misc', dataType: 'undefined' },
+ ],
+ slotRows: [
+ ['John Doe', 28, 'New York', '2022-01-15T00:00:00Z', 'N/A'],
+ ['Jane Smith', 34, 'Los Angeles', '2021-12-22T00:00:00Z', 'N/A'],
+ ['Samuel Green', 22, 'Chicago', '2023-03-10T00:00:00Z', 'N/A'],
+ ['Alice Johnson', 30, 'Houston', '2020-07-18T00:00:00Z', 'N/A'],
+ ],
+ headersWithCustomWidths: [
+ { label: 'Name', dataType: 'string', minWidth: '20px', width: '2%' },
+ { label: 'Age', dataType: 'number', minWidth: '100px', width: '33%' },
+ { label: 'City', dataType: 'string', minWidth: '200px', width: '25%' },
+ { label: 'Joined', dataType: 'date', minWidth: '150px', width: '20%' },
+ { label: 'Misc', dataType: 'undefined', minWidth: '100px', width: '20%' },
+ ],
+ customRows: [
+ ['John Doe', 28, 'New York', '2022-01-15T00:00:00Z', 'N/A'],
+ ['Jane Smith', 34, 'Los Angeles', '2021-12-22T00:00:00Z', 'N/A'],
+ ['Samuel Green', 22, 'Chicago', '2023-03-10T00:00:00Z', 'N/A'],
+ ['Alice Johnson', 30, 'Houston', '2020-07-18T00:00:00Z', 'N/A'],
+ ],
};
},
};
diff --git a/lib/KTable/index.vue b/lib/KTable/index.vue
index 4d41e05db..c3d743863 100644
--- a/lib/KTable/index.vue
+++ b/lib/KTable/index.vue
@@ -547,18 +547,18 @@ td {
.sticky-header {
position: sticky;
top: 0;
- z-index: 3;
+ z-index: 2;
}
.sticky-column {
position: sticky;
left: 0;
- z-index: 2;
+ z-index: 1;
}
th.sticky-header.sticky-column,
td.sticky-header.sticky-column {
- z-index: 4;
+ z-index: 3;
}
.sortable {
cursor: pointer;