plotly / dash-table

OBSOLETE: now part of https://github.com/plotly/dash
https://dash.plotly.com
MIT License
420 stars 72 forks source link

Invalid props combination - Error #783

Closed KevGuido closed 4 years ago

KevGuido commented 4 years ago

Hello guys,

I am getting this error: Invalid props combination

Do u know why?

import dash from dash.dependencies import Input, Output import dash_table import dash_core_components as dcc import dash_html_components as html import pandas as pd import numpy as np import plotly.express as px

df = pd.read_csv(r'C:\Users\KevinGuidoBadilla\PycharmProjects\untitled1\testing.csv')

app = dash.Dash(name)

PAGE_SIZE = 5 app.layout = html.Div([ dash_table.DataTable( id='table-paging-and-sorting', data=df.to_dict('records'), style_data={'height': 'auto'}, columns=[{'id': c, 'name': c} for c in df.columns], page_current=0, page_size=PAGE_SIZE, page_action='custom', sort_action='custom', sort_mode='single', sort_by=[], filter_action='native', fixed_rows={'headers': True}, fixed_columns={'headers': True, 'data': 1}, style_table={'height': '1200px', 'minWidth': '100%'}, style_header={'backgroundColor': 'rgb(30, 30, 30)', 'fontWeight': 'bold', 'height': 'auto',}, style_cell_conditional=[{'if': {'column_id': c}, 'backgroundColor': 'rgb(130, 130, 130)', 'color': 'white'} for c in ['Name', 'Admin']], style_cell = {'overflow': 'hidden', 'height': 'auto', 'textAlign': 'center', 'backgroundColor': 'rgb(50, 50, 50)', 'color': 'white'}, style_filter= {'backgroundColor': 'rgb(130, 130, 130)', 'color': 'white'}, style_header_conditional=[{'if': {'column_id': c},'backgroundColor': 'rgb(130, 130, 130)','color': 'white'} for c in ['Name', 'Admin']],),

])

@app.callback( Output('table-paging-and-sorting', 'data'), [Input('table-paging-and-sorting', "page_current"), Input('table-paging-and-sorting', "page_size"), Input('table-paging-and-sorting', 'sort_by')])

def update_table(page_current, page_size, sort_by): if len(sort_by): dff = df.sort_values( sort_by[0]['column_id'], ascending=sort_by[0]['direction'] == 'asc', inplace=False) else: dff = df

return dff.iloc[
    page_current*page_size:(page_current+ 1)*page_size
].to_dict('records')

if name == 'main': app.run_server(debug=True)

KevGuido commented 4 years ago

I figured this out