I am using DataTables with Ruby On Rails.
have the datasource setup for AJAX but i am trying to add an Edit Button to edit any record individually I have the following code
$('#table').DataTable({
ajax: '/get_dataset',
columns: [
{data: "id", sortable: false, bVisible: false},
{title: 'Supplier', data: 'supplier'},
{title: 'UPC', data: 'upc_fixed'},
{title: 'Product Code', data: 'product_code'},
{title: 'Category', data: 'category'},
{title: 'Description', data: 'description'},
{title: 'Item Count', data: 'item_count'},
{title: 'Manage',
mRender: function (data, type, row) {
return '<%= link_to "Edit", edit_product_path(1) %>'
}
}
],
pageLength: 25
});
What i am having problems with is how to change the "1"
in this line to be {data: "id"}
{title: 'Manage',
mRender: function (data, type, row) {
return '<%= link_to "Edit", edit_product_path(1) %>'
}
}