Forum


08:36

16/08/2009

Hey Guys,
I have added the basic grid code:
[CODE]
jQuery("#list9").jqGrid({
url: '/profiles/get subscriptions/',
datatype: "json",
colNames: ['Student Photo','Student Name','Section'],
colModel: [{
name: 'Student Photo',
index: 'id',
// width: 55
}, {
name: 'Student Name',
index: 'Student Name',
// width: 90
}, {
name: 'Section',
index: 'Section',
// width: 100
}],
rowNum: 10,
rowList: [10, 20, 30],
//imgpath: gridimgpath,
pager: jQuery('#pager9'),
sortname: 'Student Photo',
viewrecords: true,
sortorder: "desc",
multiselect: true,
caption: "Subscriptions"
}).navGrid('#pager9', {
add: false,
del: false,
edit: false,
position: "right"
});
[/CODE]
I am returning following json data from server:
[CODE]
{"records": 2, "total": 1,
"rows": [
{"Student Photo": 1, "Student Name": "jklmn jkmn", "Section": "1a "},
{"Student Photo": 1, "Student Name": "shruti sharma", "Section": "1 b "}
], "page": 1}
[/CODE]
The error I am getting is:
[CODE]
ccur is undefined
http://localhost:8001/site_media/pinax/js/jquery.jqGrid.min.js
Line 10
[/CODE]
I have no clue what I am doing wrong, it's just a basic setup.
The grid shows up with columns, but then it displays "Loding.." indefinitely and throws above error.
Thanks for your time.
09:20

16/08/2009

Hello Guys,
Solved the problem. I had to add jsonreader definition and set "repeatitems" = false.
Apparently defualt jsonreader definition wasn't correct for this setup, no idea why.
May be some one can give a thought to it?
Or may be i'll pots something when I get to know jqGrid better.
Thanks.
p.s. jqGrid is great. I was lloking for alternative to ext since they changed the license and jqGrid is a very good replacement.
10:41

16/08/2009

Here is basic grid setup from "Loading Data -> JSON Data" in demos (http://www.trirand.com/jqgrid/.....qgrid.html) :
jQuery("#list2").jqGrid({
url: 'server.php?q=2',
datatype: "json",
colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [{
name: 'id',
index: 'id',
width: 55
}, {
name: 'invdate',
index: 'invdate',
width: 90
}, {
name: 'name',
index: 'name asc, invdate',
width: 100
}, {
name: 'amount',
index: 'amount',
width: 80,
align: "right"
}, {
name: 'tax',
index: 'tax',
width: 80,
align: "right"
}, {
name: 'total',
index: 'total',
width: 80,
align: "right"
}, {
name: 'note',
index: 'note',
width: 150,
sortable: false
}],
rowNum: 10,
rowList: [10, 20, 30],
imgpath: gridimgpath,
pager: jQuery('#pager2'),
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption: "JSON Example"
}).navGrid('#pager2', {
edit: false,
add: false,
del: false
});
On it in a trial project, I got ccur undefined. Googling the error landed me to a thread on this forum, which gave a clue that a definition of jsonreader with reapeatitems = false might solve the problem.
So, I explicitely defined jsonreader as follows:
. . .
width: 150,
sortable: false
}],
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id",
userdata: "userdata",
},
rowNum: 10,
rowList: [10, 20, 30],
.....
That solved the problem.
Hope that helps.
07:22

28/01/2010

Hi,
Can you also post a sample of the Json that went with this? What is "userdata" was it in the json. I'm having the same pbm , not able to crack it yet.
my json looks like this and is a valid json
{
"records": 4,
"total": 5,
"rows": [
{
"cell": {
"lastname": "V",
"_type": "User",
"uid": "u11",
"firstname": "Megha"
}
},
{
"cell": {
"lastname": "V",
"_type": "User",
"uid": "u12",
"firstname": "Prashant"
}
},
{
"cell": {
"lastname": "A",
"_type": "User",
"uid": "u1",
"firstname": "Shalini"
}
},
{
"cell": {
"lastname": "V",
"_type": "User",
"uid": "u0",
"firstname": "Megha"
}
}
]
}
This is my grid description -
$(document).ready(function(){
// This is a basic jqGrid with a navGrid (that adds a search button)
jQuery('#list').jqGrid({
url:'/user/get_users/',
datatype: "json",
colNames: ['First Name','Last Name','UID'],
colModel: [{
name: 'firstname',
index: 'firstname'
}, {
name: 'lastname',
index: 'lastname'
}, {
name: 'uid',
index: 'uid asc, invdate'
}],
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id",
userdata: "userdata",
},
rowNum:10,
rowList:[10,20,30],
multiselect: false,
width: 700,
height: 100,
pager: jQuery('#pager'),
sortname: 'uid',
viewrecords: true,
sortorder: "asc",
caption: "Users"
}).navGrid("#pager",{edit:false,add:false,del:false},{},{width:200},{});
});
13:56

28/01/2010

Ignore me, please! I found my solution here - http://www.trirand.com/blog/?p.....-notation/
Most Users Ever Online: 715
Currently Online:
25 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66