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

Uncaught TypeError: row.Category is undefined #2

Open
hideosnes opened this issue Jul 5, 2024 · 2 comments
Open

Uncaught TypeError: row.Category is undefined #2

hideosnes opened this issue Jul 5, 2024 · 2 comments

Comments

@hideosnes
Copy link

hideosnes commented Jul 5, 2024

Strangely enough, I get the error message with my own code and with the c&p code from your example. I'm running it in VS-Code with the Live Server extension. The data console-log fires correctly, but I get "Uncaught TypeError: row.Category is undefined" in Firefox. Any ideas what might be the cause? (Edit: In Chromium there's no error message at all and it doesn't render any contents of the G-Sheet.)

`

<script src="https://cdn.jsdelivr.net/gh/pierreavn/websheetjs/dist/websheet.min.js" type="text/javascript"></script>

<script>

    websheet('stuff', {
    url: 'some url',
    sheet: 'Stuff',
    // caching: true,
    onLoaded: data => {
        if (data) {
            console.log('data =', data);
        } else {
            console.error('Error loading data from URL');
            // add error handling
        }
    },
    aliases: {
            // Aliases for each category
            'foo?': row => row['Category'].value === 'oof',   // error message indicates this line
            'bar?': row => row['Category'].value === 'rab',
            'foobar?': row => row['Category'].value === 'raboof',
        },
    })
</script> <!-- </> Websheets -->`
@pierreavn
Copy link
Owner

Do you have a "Category" column in your Google Sheet?
To debug easier, you can inspect data displayed in console with console.log('data =', data)

@hideosnes
Copy link
Author

Yeah, I basically cloned the given example. However, in the end, switching from Firefox to Chrome solved the issue. After playing around with it, I also got it to run in FF but had to do some async voodoo 😅. Will post the solution ASAP/ as soon as I've got a minute to spare.

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