rwjblue / pivot.js

Build Pivot Tables from CSV/JSON Data
http://rwjblue.github.com/pivot.js/
Other
783 stars 134 forks source link

Uncaught TypeError: Object [object Object] has no method 'on' #7

Closed pzol closed 11 years ago

pzol commented 11 years ago

I get this error in Chrome and Firefox

div == "#row-label-fields"

 // order listener
    $(div + ' input').on("click", function(){
Uncaught TypeError: Object [object Object] has no method 'on'
      if (this.checked) {

Here's the source

$(document).ready(function() {
  csv = "provider,country,tlc,date,currency,count,value\nHOTELBEDS,IT,ROM,2013-01,EUR,1,10.0\nHOTELBEDS,ES,MAD,2012-12,EUR,1,10.0\n"

  fields = [{name: 'provider',  type: 'string',  filterable: true},
            {name: 'country',   type: 'string',  filterable: true},
            {name: 'tlc',       type: 'string',  filterable: true},
            {name: 'date',      type: 'string',  filterable: true},
            {name: 'currency',  type: 'string',  filterable: true},
            {name: 'count',     type: 'integer', filterable: false, rowLabelable: false, summarizable: 'count'},
            {name: 'value',     type: 'float',   filterable: false, rowLabelable: false, summarizable: 'count'}]

  $('#pivot-menu-container').pivot_display('setup', {csv:csv,fields:fields})
})
rwjblue commented 11 years ago

It is trying to call jquery's on method (see http://api.jquery.com/on/).

What version of jquery are you using? What browser? Are you sure that you are only initializing after document ready? (See http://docs.jquery.com/Tutorials:Introducing_$(document).ready())

Sent from my iPhone

On Jan 28, 2013, at 1:07 AM, Piotr Zolnierek notifications@github.com wrote:

// order listener $(div + ' input').on("click", function(){ Uncaught TypeError: Object [object Object] has no method 'on' if (this.checked) { Here's the source

$(document).ready(function() { csv = "provider,country,tlc,date,currency,count,value\nHOTELBEDS,IT,ROM,2013-01,EUR,1,10.0\nHOTELBEDS,ES,MAD,2012-12,EUR,1,10.0\n"

fields = [{name: 'provider', type: 'string', filterable: true}, {name: 'country', type: 'string', filterable: true}, {name: 'tlc', type: 'string', filterable: true}, {name: 'date', type: 'string', filterable: true}, {name: 'currency', type: 'string', filterable: true}, {name: 'count', type: 'integer', filterable: false, rowLabelable: false, summarizable: 'count'}, {name: 'value', type: 'float', filterable: false, rowLabelable: false, summarizable: 'count'}]

$('#pivot-menu-container').pivot_display('setup', {csv:csv,fields:fields}) })

— Reply to this email directly or view it on GitHub.

pzol commented 11 years ago

My bad... I had jquery 1.6.1, works with 1.7.1