Here's the situation: I have a table that displays assignments, but the end-date of the assignment can be null.
It works fine when there are assignments with end-dates, however as soon as my data only contains a single record, and the end-date is null, it doesn't work anymore.
I'm using sAjaxSource to get the JSON data and when that happens I get the following JS-Error:
Here is my Table:
And here is the exact JSON that causes this problem:
I've tried to debug it, but I can't seem to find the reason. :/
It works fine when there are assignments with end-dates, however as soon as my data only contains a single record, and the end-date is null, it doesn't work anymore.
I'm using sAjaxSource to get the JSON data and when that happens I get the following JS-Error:
"Uncaught TypeError: Cannot read property 'length' of null" in jquery.dataTables.js:2649
Here is my Table:
projectMemberTable = $('#project_member_entries').dataTable({ "bProcessing" : true, "sAjaxDataProp" : "data", "sAjaxSource" : baseURL + memberURL + '/all', "aoColumns" : [ { "mData" : "id", "bSearchable" : false, "bVisible" : false }, { "mData" : "user", "bSearchable" : false, "bVisible" : false }, { "mData" : "userName" }, { "mData" : "role", "mRender" : function(data, type, full) { return projectRoles[data]; } }, { "mData" : "startDate", "mRender" : dataTableDate }, { "mData" : "endDate", "mRender" : dataTableDate }, { "mData" : null, "bSearchable" : false, "bSortable" : false, "fnRender" : function(oObj) { return '<a class="project_member_editer"><img src="' + baseURL + 'resources/images/icons/edit_16_blue.png" alt="Edit" />'; } }, { "mData" : null, "bSearchable" : false, "bSortable" : false, "fnRender" : function(oObj) { return '<a class="project_member_deleter"><img src="' + baseURL + 'resources/images/icons/delete_16_red.png" alt="Delete" />'; } } ] });
And here is the exact JSON that causes this problem:
{ "data" : [ { "id" : 128, "user" : 5, "project" : 127, "startDate" : "2012-12-22T15:13", "endDate" : null, "userName" : "Benjamin Boss", "role" : "LEADER" } ] }
I've tried to debug it, but I can't seem to find the reason. :/