var utility_table = $('#utility_report_table').DataTable(); $('#utility_report_table').dataTable().fnClearTable(); <% @sales.each_with_index do |sale, key| %> var row = $('<%= j render partial: "report_utilities", locals: { sale: sale } %>'); utility_table.row.add(row).draw(); <% end %> $('#start_date_display').html("<%= l @start_date.to_date, format: :long %>"); $('#end_date_display').html("<%= l @end_date.to_date, format: :long %>"); $('#note_info').removeClass('hidden'); $('#prods_total').html('<%= @total_prods.to_i %>'); $('#sales_quantity').html('<%= @sales.count %>'); $('#total_utility').html(accounting.formatMoney('<%= @total_utility %>'));