I'm trying to implement the free trial for Editor within a project.
The project is based on Servlets (apache tomcat) and I'm having some difficulty in getting it working...
var table;
var editor;
jQuery(document).ready(function()
{
editor = new $.fn.dataTable.Editor(
{
"sAjaxSource" : path+"/com/studywithdemo/JqueryDatatablePluginDemo.java",
table: "#personTable",
fields:
[
{
label: "CLI",
name: "cli"
},
{
label: "Dom. Acc Number",
name: "domAccNumb"
},
{
label: "Int. Acc Numb",
name: "intAccNumb"
},
{
label: "OPT-in Status",
name: "optInSts"
},
{
label: "Email Address",
name: "mailAddress"
}
],
formOptions:
{
bubble:
{
title: 'Edit',
buttons: false
}
}
});
$('#personTable').on('click', 'tbody td', function(e)
{
if($(this).index() > 0)
{
editor.bubble(this);
}
});
$('#personTable').DataTable(
{
columns:
[
{ data: "cli" },
{ data: "domAccNumb" },
{ data: "intAccNumb" },
{ data: "optInSts" },
{ data: "mailAddress"}
],
order: [1, 'asc'],
tableTools:
{
sRowSelect: "os",
sRowSelector: 'td:first-child',
aButtons:
[
{ sExtends: "editor_create", editor: editor },
{ sExtends: "editor_edit", editor: editor },
{ sExtends: "editor_remove", editor: editor }
]
}
});
table = $('#personTable').dataTable(
{
"bPaginate": true,
"iDisplayLength": 100,
"order": [ 0, 'asc' ],
"bInfo": true,
"iDisplayStart":0,
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : path+"/com/studywithdemo/JqueryDatatablePluginDemo.java",
"dom": 'C<"clear">lfrtip'
});
$("div.toolbar").append('<div class="btn-group" style="padding:5px "><button class="btn btn-default" id="refreshbtn" style="background:none;border:1px solid #ccc;height:30px" type="button"><span class="glyphicon glyphicon-refresh" style="padding:3px"></span></button></div>');
$("div.toolbar").css("float","right");
$('#refreshbtn').click(function()
{
table.fnStandingRedraw();
});
});
I keep getting a message saying "Cannot reinitialise DataTable". I've followed the support URL but i'm just getting myself confused.
If someone could help out that'd be great, Michael
PS: I'm working off this example: https://editor.datatables.net/examples/bubble-editing/defaultOptions.html