Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set a default row on b-table when data is empty #154

Closed
jsunier opened this issue Jul 4, 2017 · 11 comments
Closed

Cannot set a default row on b-table when data is empty #154

jsunier opened this issue Jul 4, 2017 · 11 comments
Milestone

Comments

@jsunier
Copy link

jsunier commented Jul 4, 2017

Overview of the problem

Buefy version: [0.4.4]
Vuejs version: [2.3.4]
OS/Browser: Windows 10/Chrome 59/Firefox 54

Description

Hi, i would like to add a default row in a <b-table> when my array (data) is empty.
Is there a correct way to do it without changing the source code ?

Steps to reproduce

Just make a simple <b-table> and use an empty array as data source.
Example with a simple table:
Example

@rafaberaldo
Copy link
Contributor

Does it have to be a row or do you want to display just a message that there's nothing?

@jsunier
Copy link
Author

jsunier commented Jul 4, 2017

The ideal solution will be to display a single message in a row and keep the <thead> untouched.

Using a slot on a <td> or <th> would be great i think.

Example:

<b-table
        :data="myArray"
        :paginated="true"
        :per-page="25">
        <template scope="props">
            <b-table-column field="test" label="Test">
                {{props.row.test}}
            </b-table-column>
            <b-table-column field="value" label="Value">
                {{props.row.value}}
            </b-table-column>
            <td slot="empty" colspan="2">
                Sorry, there is nothing to display here.
            </td>
        </template>
    </b-table>

@rafaberaldo
Copy link
Contributor

Yep I thought about that, it's nice to have, going to add.

@rafaberaldo rafaberaldo added this to the v0.4.5 milestone Jul 4, 2017
@coderabsolute
Copy link

Am wondering if this functionality was added?

@jtommy
Copy link
Member

jtommy commented Jul 13, 2018

@coderabsolute Yes, you have to use empty slot

@coderabsolute
Copy link

@jtommy I thought empty slot is just to display the message like No records found. But, I want my columns to be visible as well, how do I achieve this?

@jtommy
Copy link
Member

jtommy commented Jul 13, 2018

No it's no possible at the moment.

@coderabsolute
Copy link

Is there any workaround you can think of to make my columns visible when the data array is empty, please?

@jtommy
Copy link
Member

jtommy commented Jul 13, 2018

What do you mean with columns? Header?

@coderabsolute
Copy link

Ah sorry, I meant Header (not columns)..

@jtommy
Copy link
Member

jtommy commented Jul 13, 2018

There is already an issue a about it. Please follow it and we'll think how and when add it, if possible.

kikuomax added a commit to kikuomax/buefy that referenced this issue Jan 10, 2024
…programmatically opened Modal (buefy#153) (buefy#154)

* fix(lib): useI18n did not work in Modal

- Quick fixes the issue that `useI18n` did not work in a setup script
  within the context of a programmatically opened `Modal`.
  `copyAppContext` helper function also copies the private field
  `__VUE_I18N_SYMBOL__` used by `vue-i18n`. However, we will face
  similar problems unless we generalize the problem and fix it.

issue ntohq#153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants