rweng / jquery-datatables-rails

jquery-datatables gem for rails
MIT License
564 stars 339 forks source link

Uncaught TypeError: Cannot use 'in' operator to search for 'length' #198

Closed burtondav closed 8 years ago

burtondav commented 9 years ago

I'm getting the error "Uncaught TypeError: Cannot use 'in' operator to search for 'length' in isArraylike @ jquery.self-".

It happens in these lines:

var length = "length" in obj && obj.length,
      type = jQuery.type( obj );

    if ( type === "function" || jQuery.isWindow( obj ) ) {
        return false;
    }

A stackoverflow question states that "The versions 1.11.3 and 2.1.4 have this issue."

Jquery-rails versions, say:

module Jquery
  
    module Rails
    
      VERSION = "4.0.5"
    
      JQUERY_VERSION = "1.11.3"
    
      JQUERY_2_VERSION = "2.1.4"
    
      JQUERY_UJS_VERSION = "1.1.0"
  
    end

 end

How can I fix my issue?

nightsurge commented 9 years ago

As a temporary workaround, you can lock the jquery-rails gem to 4.0.4. That works in my environment where I was getting the same issues with datatables.

martinechtner commented 9 years ago

This has been fixed in datatables https://github.com/DataTables/DataTablesSrc/commit/485b259e5c02ae7 can it be integrated and a new gem cut? For my project I need jquery-rails 4.0.5, another gem requires that version.

dometto commented 8 years ago

:+1:

Looks like the same issue as #193.

bartkamphorst commented 8 years ago

Yes please! @ricardodovalle @rweng Any chance you could give us a timeline for integrating https://github.com/DataTables/DataTablesSrc/commit/485b259e5c02ae7 into a new version of the jquery-datatables-rails gem? Thanks for all your work maintaining this.

wittythemes commented 8 years ago

Confirmed locking jquery-rails gem to 4.0.4 solves it as stated by @nightsurge . Hoping this would be fixed soon

cavpollo commented 8 years ago

As @nightsurge said, locking the gem fixes the issue: gem 'jquery-rails', '=4.0.4' (Had to do this to update the gem) $ bundle update jquery-rails

+1 for a new version with the fix

abrambailey commented 8 years ago

:heavy_plus_sign::one:

dyeje commented 8 years ago

:+1:

runsnbunsn commented 8 years ago

@nightsurge thx for the workaround! drove me nuts.

istana commented 8 years ago

I believe this has been resolved with jquery-datatables-rails (3.4.0)

bartkamphorst commented 8 years ago

Can confirm that I'm no longer seeing this issue with v. 3.4.0.

rweng commented 8 years ago

Thanks!