Skip to content

Commit

Permalink
[tables] Allow slots for empty result sets (#387)
Browse files Browse the repository at this point in the history
* Create README.md

* Create meta.json

* Create index.json

* [docs] Added button-toolbar

* ESLint

* [scrollspy] Better options handling

Better handling of modifiers
A few code optimizations
Removed excess usage comments

* ESLint

* [tabs] Fix tablist role

tablist link role was inadvertently created as a bound attribute.

* [table] slots for empty result sets

* [table] ESLint

* [table] ESLint
  • Loading branch information
tmorehouse authored and pi0 committed May 12, 2017
1 parent a406722 commit 2e2e809
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/components/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
<slot :name="key" :value="item[key]" :item="item" :index="index">{{item[key]}}</slot>
</td>
</tr>
<tr v-if="showEmpty && items.length === 0"
:colspan="fields.length"
>
<slot name="empty">
<div class="text-center" v-html="emptyText"></div>
</slot>
</tr>
<tr v-if="showEmpty && items.length > 0 && _items.length === 0"
:colspan="fields.length"
>
<slot name="emptyfiltered">
<div class="text-center" v-html="emptyFilteredText"></div>
</slot>
</tr>
</tbody>
</table>
</template>
Expand Down Expand Up @@ -91,6 +105,18 @@
value: {
type: Array,
default: () => []
},
showEmpty: {
type: Boolean,
default: false
},
emptyText: {
type: String,
default: 'There are no records to show'
},
emptyFilteredText: {
type: String,
default: 'There are no records matching your request'
}
},
Expand Down

0 comments on commit 2e2e809

Please sign in to comment.