В моем файле .erb определена таблица, подобная этой:
<%= content_tag :table,
role: :end_of_day_balances_datatable,
id: 'end_of_day_balances',
class: 'table reconciletable table-responsive table-striped table-bordered table-hover',
data: { url: end_of_day_balances_path(format: :json)} do %>
<thead>
<tr>
<th>Sequence Number</th>
<th>As of Date</th>
</tr>
</thead>
Я пытался использовать https://github.com/ejbeaty/CellEdit, чтобы включить редактирование встроенных ячеек в моем файле данных выше.
У меня есть файл .js с этой функцией (как показано в basic.js в примере celledit на github)
$(document).ready(function () {
var table = $('#end_of_day_balances').DataTable();
table.MakeCellsEditable({
"onUpdate": myCallbackFunction
});
});
function myCallbackFunction(updatedCell, updatedRow, oldValue) {
console.log("The new value for the cell is: " + updatedCell.data());
console.log("The old value for that cell was: " + oldValue);
console.log("The values for each cell in that row are: " + updatedRow.data());
}
Но встроенное редактирование вообще не работает в моем файле данных с приведенным выше кодом.
Что мне здесь не хватает? Пожалуйста, помогите!