Skip to content

Commit

Permalink
fix(ui5-table): introduce hide-no-data property (#3302)
Browse files Browse the repository at this point in the history
  • Loading branch information
fifoosid authored May 25, 2021
1 parent 1683134 commit d2d4397
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 34 deletions.
4 changes: 2 additions & 2 deletions packages/main/src/Table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{{/each}}

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

Expand All @@ -38,7 +38,7 @@
</div>
</td>
</tr>
{{/if}}
{{/unless}}
{{/unless}}

{{#if growsWithButton}}
Expand Down
7 changes: 4 additions & 3 deletions packages/main/src/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const metadata = {
properties: /** @lends sap.ui.webcomponents.main.Table.prototype */ {

/**
* Defines the text that will be displayed when there is no data and <code>showNoData</code> is present.
* Defines the text that will be displayed when there is no data and <code>hideNoData</code> is not present.
*
* @type {string}
* @defaultvalue ""
Expand Down Expand Up @@ -120,8 +120,9 @@ const metadata = {
* @type {boolean}
* @defaultvalue false
* @public
* @since 1.0.0-rc.15
*/
showNoData: {
hideNoData: {
type: Boolean,
},

Expand Down Expand Up @@ -437,7 +438,7 @@ class Table extends UI5Element {
return !this._hiddenColumns[index];
});

this._noDataDisplayed = !this.rows.length && this.showNoData;
this._noDataDisplayed = !this.rows.length && !this.hideNoData;
this.visibleColumnsCount = this.visibleColumns.length;
}

Expand Down
5 changes: 4 additions & 1 deletion packages/main/test/pages/Table.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@
</thead>
</table>

<br>
<br>
<br>

<ui5-table class="no-data-table" id="tableNoData" no-data-text="No Data" show-no-data busy>
<ui5-table class="no-data-table" id="tableNoData" no-data-text="No Data" busy>
<ui5-table-column id="column-1" slot="columns">
<div class="column-content">
<ui5-label>Product</ui5-label>
Expand Down
56 changes: 28 additions & 28 deletions packages/main/test/samples/Table.sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,35 +186,35 @@ <h3>Table in MultiSelect mode</h3>
</xmp></pre>
</section>

<section>
<h3>Table with No Data</h3>
<div class="snippet flex-column">
<ui5-table class="demo-table" no-data-text="No Data" show-no-data>
<!-- Columns -->
<ui5-table-column slot="columns" style="width: 12rem">
<span style="line-height: 1.4rem">Product</span>
</ui5-table-column>

<ui5-table-column slot="columns" min-width="800" popin-text="Supplier">
<span style="line-height: 1.4rem">Supplier</span>
</ui5-table-column>

<ui5-table-column slot="columns" min-width="600" popin-text="Dimensions" demand-popin>
<span style="line-height: 1.4rem">Dimensions</span>
</ui5-table-column>

<ui5-table-column slot="columns" min-width="600" popin-text="Weight" demand-popin>
<span style="line-height: 1.4rem">Weight</span>
</ui5-table-column>

<ui5-table-column slot="columns">
<span style="line-height: 1.4rem">Price</span>
</ui5-table-column>
</ui5-table>
</div>
<section>
<h3>Table with No Data</h3>
<div class="snippet flex-column">
<ui5-table class="demo-table" no-data-text="No Data">
<!-- Columns -->
<ui5-table-column slot="columns" style="width: 12rem">
<span style="line-height: 1.4rem">Product</span>
</ui5-table-column>

<ui5-table-column slot="columns" min-width="800" popin-text="Supplier">
<span style="line-height: 1.4rem">Supplier</span>
</ui5-table-column>

<ui5-table-column slot="columns" min-width="600" popin-text="Dimensions" demand-popin>
<span style="line-height: 1.4rem">Dimensions</span>
</ui5-table-column>

<ui5-table-column slot="columns" min-width="600" popin-text="Weight" demand-popin>
<span style="line-height: 1.4rem">Weight</span>
</ui5-table-column>

<ui5-table-column slot="columns">
<span style="line-height: 1.4rem">Price</span>
</ui5-table-column>
</ui5-table>
</div>

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

0 comments on commit d2d4397

Please sign in to comment.