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

GenieBuilder -> DataTable -> Style -> Color not working #108

Open
Atitlanio opened this issue Sep 13, 2023 · 5 comments
Open

GenieBuilder -> DataTable -> Style -> Color not working #108

Atitlanio opened this issue Sep 13, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Atitlanio
Copy link

The Color property of a DataTable doesn't seem to have any effect. E.g., setting it to "primary"

Steps to Reproduce:

  1. add DataTable block
  2. Set Data Binding, Columns and Pagination
  3. Set Style -> Color to primary

app.jl.html has the following:
<q-table :data="data.data" :pagination="data_pagination" :columns="data.columns" :color="primary"></q-table>

Color remains the default white. Tried other values such as warning, red-8, blue, etc.

Temporary working solution is to set Table Style = 'background-color: #XXXXXX', e.g.,
<q-table :data="in_data.data" :pagination="data_pagination" :columns="in_data.columns" :dense="true" :table-style="'background-color: #99a0fc'"></q-table>

@essenciary essenciary self-assigned this Sep 14, 2023
@essenciary essenciary added the bug Something isn't working label Sep 14, 2023
@hhaensel
Copy link
Member

hhaensel commented Nov 6, 2023

It does change the color, but you are probably looking at the wrong part of the table. The color property changes the color of the pagination buttons, but you would need to omit the colon before color:

 <q-table :data="data.data" :pagination="data_pagination" :columns="data.columns" color="primary"></q-table>

If you want to change the color of the lines you need to change the attribute table-class:

 <q-table :data="data.data" :pagination="data_pagination" :columns="data.columns" table-class="bg-primary"></q-table>

or via StippleUI:

table(:data, table__class = "bg-primary")

Theroretically, you would also be able to set the font color here by setting table-class="bg-primary text-white", but unfortunately our current stipple-core.css overwrites this setting by

.stipple-core .q-table tbody tr {
  color: var(--st-text-2);
}

@essenciary We should somehow release that restriction without breaking our current layouts. Any idea?

@hhaensel
Copy link
Member

hhaensel commented Nov 7, 2023

Currently the only way is probably to overload the critical definition from stipple-core.css

function add_css(css::Function; update = true)
    update && deleteat!(Stipple.Layout.THEMES, nameof.(Stipple.Layout.THEMES) .== nameof(css)) 
    push!(Stipple.Layout.THEMES, css)
end

function mycss()
    [style("""
        .stipple-core .q-table tbody tr { color: inherit; }
    """)]
end

add_css(mycss)

@hhaensel
Copy link
Member

hhaensel commented Nov 7, 2023

@essenciary Shouldn't we add add_css to Stipple? We do use it in some demos like DraggableTree or TableDownloadClipboard.

@essenciary
Copy link
Member

@hhaensel Yes, looks good

@hhaensel
Copy link
Member

@Atitlanio
With the latest version of Stipple v0.27.16 we defined add_css(), so all you need to do is

function mycss()
    [style("""
        .stipple-core .q-table tbody tr { color: inherit; }
    """)]
end

add_css(mycss)

Then you can style your table by the table-class or table-style attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants