So I am really struggling getting jsGrid up and running with my Django site, specifically using a controller to load the data in the table from an ajax request. It wasn't working, so I set up this very basic configuration just to see what was going on with my loadData function in my controller. Using the below configuration, the only thing that gets printed in the console is "In Script." so it's obviously not calling loadData within the controller. Maybe this simple "test" configuration isn't correct either. Please, what am I missing here? It has to be something silly.
{% extends 'layouts/layout_1.html' %}
{% block title %}Demos{% endblock %}
{% block content%}
<div id="demos-js-grid"></div>
{% endblock %}
{% block other_js %}
<script>
$(document).ready(function() {
console.log("In Script.")
$("#demos-js-grid").jsGrid({
onDataLoading: function(args) {
console.log("On Data loading.")
},
width: "100%",
height: "100%",
inserting: true,
editing: true,
sorting: true,
autoLoad: true,
controller: {
loadData: function(filter) {
console.log("loadData being called..");
},
insertItem: function(item) {
console.log("insertItem being called..")
},
updateItem: function(item) {
console.log("updateItem being called..")
},
deleteItem: function(item) {
console.log("deleteItem being called..")
}
},
fields: [
{ name: "Client Status", type: "text", width: 50 },
{ name: "Bee Status", type: "text", width: 50 },
{ name: "Store Status", type: "text", width: 50 },
{ name: "Region", type: "text", width: 100 },
{ name: "Chain", type: "text", width: 100 },
{ name: "Store", type: "text", width: 150 },
]
});
})
</script>
{% endblock%}
divelement on the page with this id, and that thescriptblock goes after this element? - tabalin$(function() { ... })to ensure it only runs once the DOM is ready. - Daniel Roseman