diff --git a/src/components/datatable/DataTable.d.ts b/src/components/datatable/DataTable.d.ts index 4bddc01a7..0dfa91764 100755 --- a/src/components/datatable/DataTable.d.ts +++ b/src/components/datatable/DataTable.d.ts @@ -56,6 +56,8 @@ interface DataTableProps { frozenValue?: any[]; responsiveLayout?: string; breakpoing?: string; + showGridlines?: boolean; + stripedRows?: boolean; } declare class DataTable { diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index 98e933460..7da9d8b50 100755 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -301,6 +301,14 @@ export default { breakpoint: { type: String, default: '960px' + }, + showGridlines: { + type: Boolean, + default: false + }, + stripedRows: { + type: Boolean, + default: false } }, data() { @@ -1627,7 +1635,9 @@ export default { 'p-datatable-scrollable-both': this.scrollable && this.scrollDirection === 'both', 'p-datatable-flex-scrollable': (this.scrollable && this.scrollHeight === 'flex'), 'p-datatable-responsive-stack': this.responsiveLayout === 'stack', - 'p-datatable-responsive-scroll': this.responsiveLayout === 'scroll' + 'p-datatable-responsive-scroll': this.responsiveLayout === 'scroll', + 'p-datatable-striped': this.stripedRows, + 'p-datatable-gridlines': this.showGridlines } ]; }, diff --git a/src/components/treetable/TreeTable.d.ts b/src/components/treetable/TreeTable.d.ts index db3126b09..f7261a457 100755 --- a/src/components/treetable/TreeTable.d.ts +++ b/src/components/treetable/TreeTable.d.ts @@ -35,6 +35,7 @@ interface TreeTableProps { resizableColumns?: boolean; columnResizeMode?: string; indentation?: number; + showGridlines?: boolean; } declare class TreeTable { diff --git a/src/components/treetable/TreeTable.vue b/src/components/treetable/TreeTable.vue index 5d8e5caeb..708deb466 100755 --- a/src/components/treetable/TreeTable.vue +++ b/src/components/treetable/TreeTable.vue @@ -211,6 +211,10 @@ export default { indentation: { type: Number, default: 1 + }, + showGridlines: { + type: Boolean, + default: false } }, documentColumnResizeListener: null, @@ -794,6 +798,7 @@ export default { 'p-treetable-auto-layout': this.autoLayout, 'p-treetable-resizable': this.resizableColumns, 'p-treetable-resizable-fit': this.resizableColumns && this.columnResizeMode === 'fit', + 'p-treetable-gridlines': this.showGridlines }]; }, columns() { diff --git a/src/views/datatable/DataTableColResizeDemo.vue b/src/views/datatable/DataTableColResizeDemo.vue index 8224f4714..ff02bd5ea 100755 --- a/src/views/datatable/DataTableColResizeDemo.vue +++ b/src/views/datatable/DataTableColResizeDemo.vue @@ -11,7 +11,7 @@
<h3>Fit Mode</h3>
-<DataTable :value="products" :resizableColumns="true" columnResizeMode="fit" class="p-datatable-gridlines">
+<DataTable :value="products" :resizableColumns="true" columnResizeMode="fit" showGridlines>
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
@@ -46,7 +46,7 @@
</DataTable>
<h3>Expand Mode</h3>
-<DataTable :value="products" :resizableColumns="true" columnResizeMode="expand" class="p-datatable-gridlines">
+<DataTable :value="products" :resizableColumns="true" columnResizeMode="expand" showGridlines>
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
@@ -95,7 +95,7 @@ export default {
Fit Mode
-
+
@@ -105,7 +105,7 @@ export default {
Expand Mode
-
+
diff --git a/src/views/datatable/DataTableDoc.vue b/src/views/datatable/DataTableDoc.vue
index 133bb9e92..a615ed670 100755
--- a/src/views/datatable/DataTableDoc.vue
+++ b/src/views/datatable/DataTableDoc.vue
@@ -2211,6 +2211,18 @@ export default {
960px
The breakpoint to define the maximum width boundary when using stack responsive layout.
+
+ showGridlines
+ boolean
+ false
+ Whether to show grid lines between cells.
+
+
+ stripedRows
+ boolean
+ false
+ Whether to displays rows with alternating colors.
+
diff --git a/src/views/datatable/DataTableFilterDemo.vue b/src/views/datatable/DataTableFilterDemo.vue
index 2a0817af0..94096da44 100755
--- a/src/views/datatable/DataTableFilterDemo.vue
+++ b/src/views/datatable/DataTableFilterDemo.vue
@@ -11,7 +11,7 @@
Filter Menu
Filters are displayed in an overlay.
-
@@ -215,7 +215,7 @@
<div class="card">
<h5>Filter Menu</h5>
<p>Filters are displayed in an overlay.</p>
- <DataTable :value="customers1" :paginator="true" class="p-datatable-customers p-datatable-gridlines" :rows="10"
+ <DataTable :value="customers1" :paginator="true" class="p-datatable-customers" showGridlines :rows="10"
dataKey="id" v-model:filters="filters1" filterDisplay="menu" :loading="loading1" responsiveLayout="scroll"
:globalFilterFields="['name','country.name','representative.name','balance','status']">
<template #header>
diff --git a/src/views/datatable/DataTableGridLinesDemo.vue b/src/views/datatable/DataTableGridLinesDemo.vue
index 32f9adbbb..60a7a63c9 100644
--- a/src/views/datatable/DataTableGridLinesDemo.vue
+++ b/src/views/datatable/DataTableGridLinesDemo.vue
@@ -3,13 +3,13 @@
DataTable GridLines
- Adding p-datatable-gridlines displays borders between cells. Note: Some themes may always display gridlines by design.
+ Enabling showGridlines displays borders between cells. Note: Some themes may always display gridlines by design.
-
+
Header
@@ -31,7 +31,7 @@
-<DataTable :value="products" class="p-datatable-gridlines">
+<DataTable :value="products" showGridlines>
<template #header>
Header
</template>
@@ -85,7 +85,7 @@ export default {
-
+
Header
diff --git a/src/views/datatable/DataTableStripedDemo.vue b/src/views/datatable/DataTableStripedDemo.vue
index 26ac08ac0..ebda3d9b1 100644
--- a/src/views/datatable/DataTableStripedDemo.vue
+++ b/src/views/datatable/DataTableStripedDemo.vue
@@ -3,13 +3,13 @@
DataTable Striped Rows
- Adding p-datatable-striped displays striped rows.
+ Adding stripedRows displays rows with alternating colors.
-
+
@@ -25,7 +25,7 @@
-<DataTable :value="products" class="p-datatable-striped">
+<DataTable :value="products" stripedRows>
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
<Column field="category" header="Category"></Column>
@@ -73,7 +73,7 @@ export default {
-
+
diff --git a/src/views/treetable/TreeTableColResizeDemo.vue b/src/views/treetable/TreeTableColResizeDemo.vue
index 3c5dacc3b..10d4b165f 100755
--- a/src/views/treetable/TreeTableColResizeDemo.vue
+++ b/src/views/treetable/TreeTableColResizeDemo.vue
@@ -11,7 +11,7 @@
Fit Mode
-
+
@@ -20,7 +20,7 @@
Expand Mode
-
+
@@ -36,14 +36,14 @@
<h3>Fit Mode</h3>
-<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="fit" class="p-treetable-gridlines">
+<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="fit" showGridlines>
<Column field="name" header="Name" :expander="true"></Column>
<Column field="size" header="Size"></Column>
<Column field="type" header="Type"></Column>
</TreeTable>
<h3>Expand Mode</h3>
-<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" class="p-treetable-gridlines">
+<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" showGridlines>
<Column field="name" header="Name" :expander="true"></Column>
<Column field="size" header="Size"></Column>
<Column field="type" header="Type"></Column>
@@ -92,7 +92,7 @@ export default {
Fit Mode
-
+
@@ -101,7 +101,7 @@ export default {
Expand Mode
-
+
diff --git a/src/views/treetable/TreeTableDoc.vue b/src/views/treetable/TreeTableDoc.vue
index 389c18f04..86720b209 100755
--- a/src/views/treetable/TreeTableDoc.vue
+++ b/src/views/treetable/TreeTableDoc.vue
@@ -1459,6 +1459,12 @@ export default {
number
1
Indentation factor as rem value for children nodes. Defaults to 1rem.
+
+
+ showGridlines
+ boolean
+ false
+ Whether to show grid lines between cells.