72431

jqGrid typeerror jquery

Question:

I'm getting really strange error with jqGrid regarding a TypeError. I've used the grid on many other sites but for whatever reason can't it to work on my latest one.

I put in the loadError handler and I get "TypeError: a is null" and Firebug tells me the error is in jquery itself. I've multiple version of both the grid and jQuery -- same result. I made sure my code matched what was on the demoes. Still nothing. Firebug shows the json request went through.

Here's my JSON (it's one row for now):

{"total":6960,"page":1,"records":6960,"rows":[{"id":1000000477,"cell":["some title","brain","7\/15\/2010 at 8:33 AM","sometest",5,277]}]}

Here's my grid set up:

$('#threads').jqGrid({ url: '/pxr/getthreads', dataType: 'json', colNames:['Thread / Started By','Last Post','Replies','Views'], colModel:[{name:'title',index:'title',width:330,sortable:false}, {name:'lastpost',index:'lastpost', width:130,sortable:false}, {name:'replies',index:'replycount', width:60, align:"left",sortable:false}, {name:'views',index:'views', width:60, align:"center",sortable:false}], rowNum:1, autowidth:true, pager: $('div#threadsPager'), hidegrid:false, scrollOffset:0, height: 600, altRows:false, sortname: 'lastpost', viewrecords: true, emptyrecords: "No Threads Found", sortorder: 'asc', pginput:true, loadError: function(xhr,status,error){ console.log(error); }, caption:"" });

I'm using jQuery 1.4.4 and jqGrid 3.8. My server page renders valid json.

html:

<table id="threads"></table><div id="threadsPager"></div>

Any ideas?

Answer1:

The error in your code very easy, but can be difficult be seen: you should change dataType: 'json' to datatype: 'json'. After the change the data can be loaded: see <a href="http://www.ok-soft-gmbh.com/jqGrid/HapiDjus.htm" rel="nofollow">here</a>.

Recommend

  • Can C++ compiler assume a const bool & value will not change?
  • Reactive variables in Shiny for later calculations
  • How to predict a new value using simple linear regression log(y)=b0+b1*log(x)
  • Xcode 6 - Press button to play sound
  • Making turtles wait x number of ticks
  • Purescript types for buildQueryString function
  • With one EDMX file use multiple connection strings that relate to multiple databases
  • Group by one column and Show all results from another column
  • Avoid Rendering “No Data Available in the table” in Datatables
  • parameterized queries in oursql
  • Adding new column to DataFrame with values dependent on index ref
  • How to set the navigation bar to the top in Table View?
  • SQL: Getting the physical size of a subset of a table
  • How do I remove all but some records based on a threshold?
  • How do I get the list of bad records that didn't load in Bigquery?
  • Center align outputs in ipython notebook
  • Sequential (transactional) API calls in angular 4 with state management
  • custom UITableViewCell with image for highlighting
  • Retrieving value from sql ExecuteScalar()
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • Sending data from AppleScript to FileMaker records
  • vba code to select only visible cells in specific column except heading
  • Symfony2: How to get request parameter
  • To display the title for the current loaction in map in iphone
  • Do I've to free mysql result after storing it?
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Transpose CSV data with awk (pivot transformation)
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • log4net write single file for each call to log.info
  • trying to dynamically update Highchart column chart but series undefined
  • Getting error when using KSoap library to consume .NET web services
  • How to stop GridView from loading again when I press back button?
  • Is it possible to post an object from jquery to bottle.py?
  • Can't mass-assign protected attributes when import data from csv file
  • Sorting a 2D array using the second column C++
  • Unable to use reactive element in my shiny app