在我的jquery数据表中使用CellEdit时出现问题(在Ruby on Rails中)

时间:2018-10-29 06:57:45

标签: jquery ruby-on-rails datatables

我在.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文件(如github上的celledit示例中的basic.js中所示)

$(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());
}

但是使用上述代码,内联编辑在我的数据表中根本不起作用。

我在这里想念什么?请帮忙!

0 个答案:

没有答案