Skip to content

Error: Uncaught ReferenceError: BootstrapTable is not defined #242

@skar404

Description

@skar404

Error: Uncaught ReferenceError: BootstrapTable is not defined

User Django + react-bootstrap-table2 (use npm version: react-bootstrap-table-next v0.1.4)
Code:

{% load static %}{# <-- Django teg #}<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="{% static "node_modules/babel-standalone/babel.min.js" %}"></script>
    <script src="{% static "node_modules/react/umd/react.development.js" %}"></script>
    <script src="{% static "node_modules/react-dom/umd/react-dom.development.js" %}"></script>
    <script src="{% static "node_modules/react-bootstrap-table-next/dist/react-bootstrap-table2.js" %}"></script>

    <link rel="stylesheet" href="{% static "node_modules/react-bootstrap-table-next/dist/react-bootstrap-table2.css" %}">
</head>
<body>

<div class="container" id="container">
    <p>Loading components...</p>
</div>

    <script type="text/babel">
        const products = [];
    
        function addProducts(quantity) {
            const startId = products.length;
            for (let i = 0; i < quantity; i++) {
                const id = startId + i;
                products.push({
                    id: id,
                    name: 'Item name ' + id,
                    price: 2100 + i
                });
            }
        }
    
        addProducts(5);
    
        const columns = [{
            dataField: 'id',
            text: 'Product ID'
        }, {
            dataField: 'name',
            text: 'Product Name'
        }, {
            dataField: 'price',
            text: 'Product Price'
        }];
    
        class RenderBootstrapTable extends React.Component {
            render() {
                return <BootstrapTable keyField='id' data={products} columns={columns}/>
            }
        }
    
        ReactDOM.render(
            <BootstrapTable/>,
            document.getElementById('container')
        );
    </script>
</body>
</html>

{% static "path"%} - link to file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions