import dash_components_table_own as dto
import dash
import dash_html_components as html
import os

import pandas as pd

# Loading a file
data_path = os.path.join(os.getcwd(), os.path.join('..', 'data'))
data_file = os.path.join(data_path, 'usa-agricultural-exports-2011.csv')
df = pd.read_csv(data_file)

# Still making a table inside a python code.
def generate_table(dataframe, max_rows=10):
    return [html.Tr([html.Th(col) for col in dataframe.columns])] + \
        [html.Tr([
            html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
        ]) for i in range(min(len(dataframe), max_rows))]


app = dash.Dash()
app.layout = html.Div(children=[
    dto.TableOwn(generate_table(df), label="US Agriculture Exports (2011)", id='my-table', wrapperClass='test-class')
])

app.scripts.config.serve_locally = True

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


@@ -91,17 +91,16 @@
 port os%0A
-%0A
 import p
@@ -116,24 +116,55 @@
 pd%0A%0A
+%0A
 # 
-Loading a file
+Init of data file and dash%0Aapp = dash.Dash()
 %0Adat
@@ -332,52 +332,8 @@
 e)%0A%0A
-# Still making a table inside a python code.
 %0Adef
@@ -372,16 +372,212 @@
 ows=10):
+%0A    %22%22%22 Generates Table contents (Inner HTML)%0A    :param dataframe: pandas read document%0A    :param max_rows: maximum rows to display in the tablea%0A    :return: Dash by Plotly table data.%0A    %22%22%22
 %0A    ret
@@ -791,33 +791,40 @@
 ws))%5D%0A%0A%0A
-app = dash.Dash()
+# Using custom component
 %0Aapp.lay
@@ -866,16 +866,25 @@
 ableOwn(
+%0A        
 generate
@@ -894,16 +894,24 @@
 ble(df),
+%0A       
  label=%22
@@ -941,16 +941,24 @@
 (2011)%22,
+%0A       
  id='my-
@@ -964,16 +964,24 @@
 -table',
+%0A       
  wrapper
@@ -1002,14 +1002,20 @@
 ass'
+%0A    
 )%0A%5D)%0A%0A
+%0A
 app.
@@ -1050,17 +1050,16 @@
  = True%0A
-%0A
 if __nam
@@ -1108,9 +1108,8 @@
 g=True)%0A
-%0A

tidy example app.py