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

Problems using the spreadsheet module in an existing project #3232

Open
dberardo-com opened this issue Nov 21, 2023 · 3 comments
Open

Problems using the spreadsheet module in an existing project #3232

dberardo-com opened this issue Nov 21, 2023 · 3 comments

Comments

@dberardo-com
Copy link

so, i have been able to start the demo environment. what i would like to do next, is to embed the spreadsheet within an existing javascript / react project.

basically i want to use the spreadsheet by simpling importing the right objects from the right packages ... but i am failing badly.
indeed if i look at the index.html demo file i see a lot of imports from compiled folders like node_modules or build/, but what i am aiming for is to mount the spreadsheet without doing any pre-compilation.

unfortunately the demo example is too complex to follow through, and there are certain variable which are sort of "magically" appearing, like the o_spreadsheet and owl variables.
i get from the rollup configurations the owl is an alias, so i can use its package instead to import elements, that is instead of doing "const {...stuff} = owl" i can do "import {stuff} from @owl/..." which is ok, but i have no idea where the o_spreadsheet module is defined. any hint ?

also: is there simpler, minimal example to get started in this sense ? the demo one is quite extensive

@dberardo-com
Copy link
Author

in particular, the latest error i am facing is something like:

Error: Cannot find the definition of component "Spreadsheet", missing static components key in parent at owl.es.js:5705:31

and i see nothing being mounted on screen

@dberardo-com
Copy link
Author

i have managed to come somewhat further, indeed this was the crucial part to start a new minimal spreadsheet:

let model = new Model(data) // <-- here one can use data.js from the demo
const rootApp = new owl.App(Spreadsheet, { props: { model } });
rootApp.addTemplates(templates); // <-- this are the templates from the .xml demo file
rootApp.mount(document.body, {})

... cleanup
rootApp.destroy()

@Mar4ikler
Copy link

In the end, did you manage posting this simple example in existing js / react project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants