-
Notifications
You must be signed in to change notification settings - Fork 431
Closed
Description
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
Labels
No labels