Giter Site home page Giter Site logo

Comments (5)

Marc-Andre-Rivet avatar Marc-Andre-Rivet commented on August 24, 2024

@charleyferrari You need to set type='dropdown' on the column, default is 'text', the column_static_dropdown will not override the type behavior

from dash-table.

cldougl avatar cldougl commented on August 24, 2024

@charleyferrari can you edit your example and see if that resolves the issue you're seeing?

from dash-table.

charleyferrari avatar charleyferrari commented on August 24, 2024

@Marc-Andre-Rivet @cldougl hmm... still not working for me.

Here's what I have:

import dash
from dash.dependencies import Input, Output, State

import dash_html_components as html
import dash_table

import pandas as pd

collist = ['one', 'two', 'three', 'category']
categories = ['Great', 'Good', 'Fair', 'Poor']

df = pd.DataFrame({i: [1, 2, 3, 4] if i != 'category'
                   else ['Great', 'Good', 'Poor', 'Fair']
                   for idx, i in enumerate(collist)})
df = df[collist]
df = df.values


app = dash.Dash()
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

app.layout = html.Div([
    dash_table.Table(
        id='table',
        dataframe=df,
        columns=[{'id': idx, 'name': i} if i != 'category'
                 else {'id': idx, 'name': i, 'type': 'dropdown'}
                 for idx, i in enumerate(collist)],
        editable=True,
        row_deletable=True,
        sorting=True,
        # Toggling this
        n_fixed_rows=1,
        column_static_dropdown=[{
            'id': 'bbb',
            'dropdown': [{'label': i, 'value': i} for i in categories]
        }],
        row_selectable='single'
    )
])


@app.callback(
    Output('table', 'dataframe'),
    [Input('table', 'dataframe_timestamp')],
    [State('table', 'dataframe')]
)
def table_it(df_ts, df):
    print('called it')
    return df


if __name__ == '__main__':
    app.run_server(debug=True)

The only change being columns = [..., where I added the dropdown key for category.

I'll continue troubleshooting to make sure I'm not missing something.

from dash-table.

Marc-Andre-Rivet avatar Marc-Andre-Rivet commented on August 24, 2024

@charleyferrari As discussed outside this thread, column_static_dropdown 'id' needs to match the column ids above.

from dash-table.

charleyferrari avatar charleyferrari commented on August 24, 2024

@Marc-Andre-Rivet Thanks, it's working for me, so this can be closed out.

from dash-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.