Skip to content

what is the best way to implement column_counter functionality ? #64

Closed
@codemilan

Description

@codemilan

In my js file as per datatable doc 'http://www.datatables.net/examples/api/counter_columns.html':

    $(document).on('ready page:load', function() {
      var t = $('#uploaded_songs_table').dataTable({
      "processing": true,
      "serverSide": true,
      "ajax": $('#uploaded_songs_table').data('source'),
      "pagingType": 'full_numbers',
      "columnDefs": [ {
            "searchable": false,
            "orderable": false,
            "targets": 0
        } ],
        "order": [[ 1, 'asc' ]]
    });
    t.on( 'order.dt search.dt', function () {
        t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
            cell.innerHTML = i+1;
        } );
    } ).draw();
  });

In datatable file:

def_delegator :@view, :tag
def data
    records.map do |record|
      [
        tag("td"),
        best_in_place(record, :title),
        best_in_place(record, :song_name),
      ]
    end
end

but i get these error:
ERROR TypeError: can't convert nil into an exact number
/home/milan/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/core_ext/time/calculations.rb:218:in -' /home/milan/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/core_ext/time/calculations.rb:218:inminus_with_duration'
/home/milan/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/core_ext/time/calculations.rb:229:in `minus_with_coercion'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions