Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

I am getting error Invalid argument data[0].pathOffset passed into DataTable with ID "canvaas-table". Expected one of type [string, number, boolean]. #67

Open
muntakim1 opened this issue Jul 17, 2024 · 0 comments

Comments

@muntakim1
Copy link

Hello,

error Invalid argument `data[0].pathOffset` passed into DataTable with ID "canvaas-table". Expected one of type [string, number, boolean].

While running the code:

from dash import Dash, html, dash_table, Input, Output, callback
from dash.exceptions import PreventUpdate
from dash_canvas import DashCanvas
import json

app = Dash(__name__)

filename = 'https://raw.githubusercontent.com/plotly/datasets/master/mitochondria.jpg'
canvas_width = 500

columns = ['type', 'width', 'height', 'scaleX', 'strokeWidth', 'path']

app.layout = html.Div([
    html.H6('Draw on image and press Save to show annotations geometry'),
    DashCanvas(id='annot-canvas',
               lineWidth=5,
               filename=filename,
               width=canvas_width,
               ),
    dash_table.DataTable(id='canvaas-table',
              style_cell={'textAlign': 'left'},
              columns=[{"name": i, "id": i} for i in columns]),
    ])


@callback(Output('canvaas-table', 'data'),
              Input('annot-canvas', 'json_data'))
def update_data(string):
    if string:
        data = json.loads(string)
    else:
        raise PreventUpdate
    return data['objects'][1:]


if __name__ == '__main__':
    app.run(debug=True)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant