Im trying to setup a table using the jQuery jTable plugin.
Atm. it’s very basic. But I can’t get it working. I get a JScript runtime Error every time i try and load the table.
My script looks like this:
$(document).ready(function () {
var listURL= $('#EnvTableContainer').attr('data-list-url');
var deleteURL = $('#EnvTableContainer').attr('data-delete-url');
var updateURL = $('#EnvTableContainer').attr('data-update-url');
var createURL = $('#EnvTableContainer').attr('data-create-url');
$('#EnvTableContainer').jtable({
title: 'Environments',
actions: {
listAction: listURL,
deleteAction: deleteURL,
updateAction: updateURL,
createAction: createURL
},
fields: {
Id: {
key: true,
create: false,
edit: false,
list: false
},
Name: {
title: 'Name',
width: '50%'
}
}
});
$('#EnvTableContainer').jtable('load');
});
When I try and run it, it breaks and stops in jquery-1.8.0-min.js file on this:
var e,f=0,g=a.length,h=g===b
Anyone know what is the problem?
I have been looking at the API for jQuery.jTable. But can’t find anywhere, that the length can be set.
Probably you are returning wrong formatted result. listAction URL must return a json object as shown jTable’s documantation: http://jtable.org/ApiReference#act-listAction