Can't get dataSrc to work?
Can't get dataSrc to work?
ashimema
Posts: 1Questions: 1Answers: 0
I'm struggling to get past the following error:
'TypeError: api.column(...).dataSrc is not a function'
$(document).ready(function() {
tillTable = $('#tills_editor').dataTable(
$.extend(true, {}, dataTablesDefaults, {
"ajax": "/cgi-bin/koha/svc/tills",
"columnDefs": [{
"targets": 0,
"orderable": true,
"searchable": false,
"data": "tillid"
}, {
"targets": 1,
"orderable": true,
"searchable": true,
"data": "description"
}, {
"targets": 2,
"orderable": true,
"searchable": true,
"data": "branch"
}],
"order": [1, 'asc'],
"drawCallback": function(settings) {
var api = this.api();
console.log(api.rows({
page: 'current'
}).data());
// add jEditable handlers
$('#tills_editor tbody tr td[id!="no_edit"]').editable(
function(value, settings) {
var columnSrc = api.column(tillTable.fnGetPosition(this)[2]).dataSrc(); <------------
alert(JSON.stringify(columnSrc));
var oldData = api.row(tillTable.fnGetPosition(this)[0]).data();
alert(JSON.stringify(oldData));
var newData = {
tillid: oldData.tillid,
description: value,
branch: oldData.branch
};
alert(JSON.stringify(newData));
//'/cgi-bin/koha/svc/tills'
return (value);
}, {
indicator: 'Saving...',
tooltip: 'Click to edit...',
}
);
},
}))
});
Anyone got any idea's what's going on?
This discussion has been closed.
Answers
column().dataSrc()
was introduced in v1.10.3. Perhaps you are using an older version?Allan