I'm using gem 'jquery-datatables-rails', '~> 2.1.10.0.3' in a Rails project.
I'm just starting an attempt to use the dataTable add row feature.
This is my JavaScript (Coffeescript):
t = $("#dataTableAdd").dataTable
bfilter: true
iDisplayLength: 25
bLengthChange: true
"sPaginationType": "bootstrap"
oColVis:
buttonText: "Hide/Show"
bRestore: true
sDom: "C<\"clear\">lrTtiXp"
oTableTools:
aButtons: [
sExtends: "xls"
sButtonText: "Save Excel"
,
sExtends: "pdf"
sPdfOrientation: "landscape"
sPdfMessage: "pdf"
mColumns: "visible"
sButtonText: "Save PDF"
]
$("#addRow").on "click", ->
t.row.add([
"Name"
"Description"
"Type"
"Count"
"Manufacturer"
"Man Date"
"Purchase Date"
"Purchase Price"
"Actions"
"Actions2"
]).draw()
return
I'm getting this error when I click on the addrow button:
Uncaught TypeError: Cannot read property 'add' of undefined
It happens on the t.row.add line.
Thanks for the help!