Fixed #1024 - Add showGridlines and stripedRows props to DataTable
parent
cc1a9c13a1
commit
0922b16850
|
@ -56,6 +56,8 @@ interface DataTableProps {
|
|||
frozenValue?: any[];
|
||||
responsiveLayout?: string;
|
||||
breakpoing?: string;
|
||||
showGridlines?: boolean;
|
||||
stripedRows?: boolean;
|
||||
}
|
||||
|
||||
declare class DataTable {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
];
|
||||
},
|
||||
|
|
|
@ -35,6 +35,7 @@ interface TreeTableProps {
|
|||
resizableColumns?: boolean;
|
||||
columnResizeMode?: string;
|
||||
indentation?: number;
|
||||
showGridlines?: boolean;
|
||||
}
|
||||
|
||||
declare class TreeTable {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<h5>Fit Mode</h5>
|
||||
<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>
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
<div class="card">
|
||||
<h5>Expand Mode</h5>
|
||||
<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>
|
||||
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
<pre v-code><code><template v-pre>
|
||||
<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 {
|
|||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<h5>Fit Mode</h5>
|
||||
<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>
|
||||
|
@ -105,7 +105,7 @@ export default {
|
|||
|
||||
<div class="card">
|
||||
<h5>Expand Mode</h5>
|
||||
<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>
|
||||
|
|
|
@ -2211,6 +2211,18 @@ export default {
|
|||
<td>960px</td>
|
||||
<td>The breakpoint to define the maximum width boundary when using stack responsive layout.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>showGridlines</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Whether to show grid lines between cells.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>stripedRows</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Whether to displays rows with alternating colors.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,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>
|
||||
|
@ -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>
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<div class="content-section introduction">
|
||||
<div class="feature-intro">
|
||||
<h1>DataTable <span>GridLines</span></h1>
|
||||
<p>Adding <b>p-datatable-gridlines</b> displays borders between cells. Note: Some themes may always display gridlines by design.</p>
|
||||
<p>Enabling <b>showGridlines</b> displays borders between cells. Note: Some themes may always display gridlines by design.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<DataTable :value="products" class="p-datatable-gridlines">
|
||||
<DataTable :value="products" showGridlines>
|
||||
<template #header>
|
||||
Header
|
||||
</template>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<LiveEditor name="DataTableDemo" :sources="sources" service="ProductService" data="products-small" :components="['Column']" />
|
||||
</div>
|
||||
<pre v-code><code><template v-pre>
|
||||
<DataTable :value="products" class="p-datatable-gridlines">
|
||||
<DataTable :value="products" showGridlines>
|
||||
<template #header>
|
||||
Header
|
||||
</template>
|
||||
|
@ -85,7 +85,7 @@ export default {
|
|||
<div class="layout-content">
|
||||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<DataTable :value="products" class="p-datatable-gridlines">
|
||||
<DataTable :value="products" showGridlines>
|
||||
<template #header>
|
||||
Header
|
||||
</template>
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<div class="content-section introduction">
|
||||
<div class="feature-intro">
|
||||
<h1>DataTable <span>Striped Rows</span></h1>
|
||||
<p>Adding <i>p-datatable-striped</i> displays striped rows.</p>
|
||||
<p>Adding <i>stripedRows</i> displays rows with alternating colors.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<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>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<LiveEditor name="DataTableDemo" :sources="sources" service="ProductService" data="products-small" :components="['Column']" />
|
||||
</div>
|
||||
<pre v-code><code><template v-pre>
|
||||
<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 {
|
|||
<div class="layout-content">
|
||||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<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>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<h5>Fit Mode</h5>
|
||||
<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>
|
||||
|
@ -20,7 +20,7 @@
|
|||
|
||||
<div class="card">
|
||||
<h5>Expand Mode</h5>
|
||||
<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>
|
||||
|
@ -36,14 +36,14 @@
|
|||
</div>
|
||||
<pre v-code><code><template v-pre>
|
||||
<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 {
|
|||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<h5>Fit Mode</h5>
|
||||
<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>
|
||||
|
@ -101,7 +101,7 @@ export default {
|
|||
|
||||
<div class="card">
|
||||
<h5>Expand Mode</h5>
|
||||
<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>
|
||||
|
|
|
@ -1459,6 +1459,12 @@ export default {
|
|||
<td>number</td>
|
||||
<td>1</td>
|
||||
<td>Indentation factor as rem value for children nodes. Defaults to 1rem.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>showGridlines</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>Whether to show grid lines between cells.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue