Skip to content

Commit d2d4397

Browse files
authored
fix(ui5-table): introduce hide-no-data property (#3302)
1 parent 1683134 commit d2d4397

File tree

4 files changed

+38
-34
lines changed

4 files changed

+38
-34
lines changed

packages/main/src/Table.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{{/each}}
3030

3131
{{#unless rows.length}}
32-
{{#if showNoData}}
32+
{{#unless hideNoData}}
3333
<tr class="ui5-table-no-data-row-root" role="row">
3434
<td colspan="{{visibleColumnsCount}}" role="cell">
3535

@@ -38,7 +38,7 @@
3838
</div>
3939
</td>
4040
</tr>
41-
{{/if}}
41+
{{/unless}}
4242
{{/unless}}
4343

4444
{{#if growsWithButton}}

packages/main/src/Table.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const metadata = {
7171
properties: /** @lends sap.ui.webcomponents.main.Table.prototype */ {
7272

7373
/**
74-
* Defines the text that will be displayed when there is no data and <code>showNoData</code> is present.
74+
* Defines the text that will be displayed when there is no data and <code>hideNoData</code> is not present.
7575
*
7676
* @type {string}
7777
* @defaultvalue ""
@@ -120,8 +120,9 @@ const metadata = {
120120
* @type {boolean}
121121
* @defaultvalue false
122122
* @public
123+
* @since 1.0.0-rc.15
123124
*/
124-
showNoData: {
125+
hideNoData: {
125126
type: Boolean,
126127
},
127128

@@ -437,7 +438,7 @@ class Table extends UI5Element {
437438
return !this._hiddenColumns[index];
438439
});
439440

440-
this._noDataDisplayed = !this.rows.length && this.showNoData;
441+
this._noDataDisplayed = !this.rows.length && !this.hideNoData;
441442
this.visibleColumnsCount = this.visibleColumns.length;
442443
}
443444

packages/main/test/pages/Table.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@
135135
</thead>
136136
</table>
137137

138+
<br>
139+
<br>
140+
<br>
138141

139-
<ui5-table class="no-data-table" id="tableNoData" no-data-text="No Data" show-no-data busy>
142+
<ui5-table class="no-data-table" id="tableNoData" no-data-text="No Data" busy>
140143
<ui5-table-column id="column-1" slot="columns">
141144
<div class="column-content">
142145
<ui5-label>Product</ui5-label>

packages/main/test/samples/Table.sample.html

+28-28
Original file line numberDiff line numberDiff line change
@@ -186,35 +186,35 @@ <h3>Table in MultiSelect mode</h3>
186186
</xmp></pre>
187187
</section>
188188

189-
<section>
190-
<h3>Table with No Data</h3>
191-
<div class="snippet flex-column">
192-
<ui5-table class="demo-table" no-data-text="No Data" show-no-data>
193-
<!-- Columns -->
194-
<ui5-table-column slot="columns" style="width: 12rem">
195-
<span style="line-height: 1.4rem">Product</span>
196-
</ui5-table-column>
197-
198-
<ui5-table-column slot="columns" min-width="800" popin-text="Supplier">
199-
<span style="line-height: 1.4rem">Supplier</span>
200-
</ui5-table-column>
201-
202-
<ui5-table-column slot="columns" min-width="600" popin-text="Dimensions" demand-popin>
203-
<span style="line-height: 1.4rem">Dimensions</span>
204-
</ui5-table-column>
205-
206-
<ui5-table-column slot="columns" min-width="600" popin-text="Weight" demand-popin>
207-
<span style="line-height: 1.4rem">Weight</span>
208-
</ui5-table-column>
209-
210-
<ui5-table-column slot="columns">
211-
<span style="line-height: 1.4rem">Price</span>
212-
</ui5-table-column>
213-
</ui5-table>
214-
</div>
189+
<section>
190+
<h3>Table with No Data</h3>
191+
<div class="snippet flex-column">
192+
<ui5-table class="demo-table" no-data-text="No Data">
193+
<!-- Columns -->
194+
<ui5-table-column slot="columns" style="width: 12rem">
195+
<span style="line-height: 1.4rem">Product</span>
196+
</ui5-table-column>
197+
198+
<ui5-table-column slot="columns" min-width="800" popin-text="Supplier">
199+
<span style="line-height: 1.4rem">Supplier</span>
200+
</ui5-table-column>
201+
202+
<ui5-table-column slot="columns" min-width="600" popin-text="Dimensions" demand-popin>
203+
<span style="line-height: 1.4rem">Dimensions</span>
204+
</ui5-table-column>
205+
206+
<ui5-table-column slot="columns" min-width="600" popin-text="Weight" demand-popin>
207+
<span style="line-height: 1.4rem">Weight</span>
208+
</ui5-table-column>
209+
210+
<ui5-table-column slot="columns">
211+
<span style="line-height: 1.4rem">Price</span>
212+
</ui5-table-column>
213+
</ui5-table>
214+
</div>
215215

216-
<pre class="prettyprint lang-html"><xmp>
217-
<ui5-table class="demo-table" no-data-text="No Data" show-no-data>
216+
<pre class="prettyprint lang-html"><xmp>
217+
<ui5-table class="demo-table" no-data-text="No Data">
218218
<ui5-table-column slot="columns" style="width: 12rem">
219219
<span style="line-height: 1.4rem">Product</span>
220220
</ui5-table-column>

0 commit comments

Comments
 (0)