jqgrid has no method ‘addJSONData’

Posted by

Working with jqGrid, placing a Json response as data source, trying to do this stuff according to jqGrid documentation gave me:

gridPlayers.addJSONData(jsonStr );

But I was left stranded with this message:

[mygrid] ...has no method 'addJSONData'

Using this post: http://stackoverflow.com/questions/545714/jqgrid-addjsondata-asp-net-2-0-ws I realized that the data source is actually an array and some kind of wrapping is needed for the Json data so:


var jsonObject = eval('(' + jsonStr + ')');
gridPlayers[0].addJSONData(jsonObject);

works 🙂

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s