Javascript Table Creation then add dataTable not working
Javascript Table Creation then add dataTable not working
Here is my code:
[code]
$('#' + type[1] + "Info").html('Project NameDeadlineActions');
var projects = Project.get();
for(var projectID in projects) {
if(projects.hasOwnProperty(projectID)) {
if(projects[projectID][2] == 0) {
open = 'Edit Complete ';
}
else {
open = 'Completed! ';
}
$('#' + type[1] + "Info tbody").append('' + projects[projectID][0] + '' + (projects[projectID][1] != null?projects[projectID][1]:'') + '' + open + 'Delete');
}
}
$('#proj_table').dataTable({
bPaginate: true,
sPaginationType: 'full_numbers',
bStateSave: true,
});
[/code]
I am not getting any errors, but DataTable is not being applied to the table. DataTable has not been initialized prior.
[code]
$('#' + type[1] + "Info").html('Project NameDeadlineActions');
var projects = Project.get();
for(var projectID in projects) {
if(projects.hasOwnProperty(projectID)) {
if(projects[projectID][2] == 0) {
open = 'Edit Complete ';
}
else {
open = 'Completed! ';
}
$('#' + type[1] + "Info tbody").append('' + projects[projectID][0] + '' + (projects[projectID][1] != null?projects[projectID][1]:'') + '' + open + 'Delete');
}
}
$('#proj_table').dataTable({
bPaginate: true,
sPaginationType: 'full_numbers',
bStateSave: true,
});
[/code]
I am not getting any errors, but DataTable is not being applied to the table. DataTable has not been initialized prior.
This discussion has been closed.
Replies
[code]
console.log( $('#proj_table')[0] );
[/code]
Allan
When I do the code suggested I get the table.
I think I'd probably need to see the page in action to be able to offer any further help.
Allan
Datatables is applied to the project tab with the View Command.
This uses local storage so you can add your own data.; It is not stored on my server.
Allan
taskInfo is a div.
And you are looking at the wrong tab. You need to be under Projects to see the code. Tasks has not been set up.
[code]
Project Name
Deadline
Actions
[/code]