Skip to content

Uncaught TypeError: Cannot read property 'fnInit' of undefined #191

@tsai146

Description

@tsai146

I am doing "Twitter Bootstrap 3 Installation" with straight forward zero configuration, but still, I am getting this error

Uncaught TypeError: Cannot read property 'fnInit' of undefined

This is what I have in coffeescript

$(selector).DataTable

I tried to add break point in Chrome developer tool, and apparently the type is "bootstrap".

            type   = settings.sPaginationType,
            plugin = DataTable.ext.pager[ type ],
            modern = typeof plugin === 'function',
            redraw = function( settings ) {
                _fnDraw( settings );
            },
            node = $('<div/>').addClass( settings.oClasses.sPaging + type )[0],
            features = settings.aanFeatures;

        if ( ! modern ) {
            plugin.fnInit( settings, node, redraw );
        }

I google around, and some one suggest to put in pagingType: "full_numbers", but it doesn't do anything different for me. I still get "bootstrap" as type still.

If I remove my code from coffeescript, but type in Chrome console $(selector).DataTable(). It works.

What did I do wrong?
How can we overwrite pagingType, and why it's keep setting to "bootstrap" if no such option available?

This is my Gemfile

...
gem 'jquery-rails'
gem 'bootstrap-sass', '~> 3.3.5'
gem 'jquery-datatables-rails', '~> 3.3.0'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions