Forum
Topic RSS
08:54
18/08/2008
OfflineI'm trying to set up the navgrid. I wasn't sure what all modules were needed so I just downloaded them all. For some reason, the grid never loads the data. I confirmed the data is in fact being sent. I've tried both json and xml but no matter what, no errors or anything. Nothing loads into the grid. It always shows "0 of <no number here>" nothing is displayed. I see no errors in the console so I'm not sure where to go. Suggestions?
13:17
10/08/2009
OfflineHi Steffan,
You posted almost no information which can be used to help you. In case of any problems in loading of data in the grid you should allways post
- The version number of jqGrid which you use.
- The full definition of jqGrid, especially colModel, datatype, abd jsonReader/xmlReader parameters it any used.
- The test JSON/XML data which will be really send back to the jqGrid from the server. You can use for example Fiddler or Firebug to catch tha data.
If you suspect that you don't load all jqGrid modules you should open jquery.jqGrid.min.js and examine the list of modules in the comment at the begining of the JS-file (search for "Modules:" text).
Best regards
Oleg
17:00
18/08/2008
OfflineI was finally able to get the XML to work but find it may be a bit heavy where I can use JSON instead. I'll try fooling with the JSON a bit later. I'm using the latest jqGrid from the site. I copied the example directly from the Navigator example using only a few tweaks.
$("#navgrid").jqGrid({
url:"/async/users.lasso",
datatype: "XML",
hidegrid: false,
colNames:["User ID","First Name","Last Name","Email","Password","Groups","Notes","Admin"],
colModel:[
{name:'id', index:'id', width:55, editable:false, editoptions:{readonly:true,size:10}, hidden:true},
{name:'firstname', index:'firstname', width:100, editable:true, editoptions:{size:25}, editrules:{required:true}},
{name:'lastname', index:'lastname', width:100, editable:true, editoptions:{size:25}, editrules:{required:true}},
{name:'email', index:'email', width:100, editable:true, editoptions:{size:25}, editrules:{email:true, required:true}},
{name:'password', index:'password', width:100, hidden:true, editable:true, editoptions:{edithidden:true}},
{name:'groups', index:'groups', width:100, editable:true, edittype:"textarea", editoptions:{rows:"2",cols:"25"}, align:"left", sortable:"no"},
{name:'notes', index:'notes', width:200, editable:true, edittype:"textarea", editoptions:{rows:"2",cols:"25"}, align:"left"},
{name:'isadmin', index:'isadmin', width:60, editable:true, edittype:"checkbox", editoptions:{value:"Yes:No"}, align:"left"}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pagernav',
sortname: "id",
viewrecords: true,
sortorder: "desc",
caption:"Existing Users",
editurl:"/async/users.lasso",
height:210
});
$("#navgrid").jqGrid('navGrid','#pagernav',
{}, //options
{height:280,reloadAfterSubmit:false}, // edit options
{height:280,reloadAfterSubmit:false}, // add options
{reloadAfterSubmit:false}, // del options
{} // search options
);
The XML for example:
<?xml version='1.0' encoding='utf-8'?>
<rows>
<page>1</page><total>2</total><records>13</records>
<row id='13'><cell>13</cell><cell>Joe</cell><cell>Dirt</cell><cell>abc</cell><cell>0.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='12'><cell>12</cell><cell>Hank</cell><cell>Williams</cell><cell>def</cell><cell>140.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='11'><cell>11</cell><cell>2007-10-06</cell><cell>abc</cell><cell>ghi</cell><cell>120.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='10'><cell>10</cell><cell>2007-10-06</cell><cell>abc</cell><cell>100.00</cell><cell>20.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='9'><cell>9</cell><cell>2007-10-06</cell><cell>abc</cell><cell>200.00</cell><cell>40.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='8'><cell>8</cell><cell>2007-10-06</cell><cell>abc</cell><cell>200.00</cell><cell>0.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='7'><cell>7</cell><cell>2007-10-05</cell><cell>abc</cell><cell>120.00</cell><cell>12.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='6'><cell>6</cell><cell>2007-10-05</cell><cell>abc</cell><cell>50.00</cell><cell>10.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='5'><cell>5</cell><cell>2007-10-05</cell><cell>abc</cell><cell>100.00</cell><cell>0.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
<row id='4'><cell>4</cell><cell>2007-10-04</cell><cell>abc</cell><cell>150.00</cell><cell>0.00</cell><cell>No</cell><cell>No</cell><cell>No</cell></row>
</rows>
I'll post the JSON when I go back to it but is there a trick of a sort I may be missing?
21:36
10/08/2009
OfflineHi Steffan,
I suspect that you problem is the "Content-Type" which not set or set wrong on the server ("/async/users.lasso"). I could reproduce the problem with jQuery 1.4.4 if I use at the response Steffan.txt file with the contain like you posted. In the case my web server place Content-Type: text/plain in the header of the response and one see ajax parsing error. Because use don't define loadError event hendle you just see empty grid. You can see the problem reproduced on the demo. If I just rename the file to Steffan.xml, my web server will use Content-Type: application/xml and the same code will work (see here). Of course in case or dynamic data you have to set "Content-Type" in other way, but the same effects will stay.
One more way to fix the problem is to use jQuery 1.5 (I used jQuery 1.5.1): see the fixed demo. In jQuery 1.5 the ajax module is full rewritten and the problems which one has in httpData function of jQuery one don't has more.
Best regards
Oleg
22:23
18/08/2008
OfflineI was able to get the XML working. There was something weird. I'm not sure what I did but it just stated working. I did have the content type in there though. So, now I am looking to do the JSON rather than XML to lighten the load.
I just downloaded the jQuery UI a couple days ago and it still ships with 1.4.4. Is the UI compatible with 1.5.1?
Thanks,
Steffan
22:37
10/08/2009
OfflineI recommend you fo use JSON instead of XML is you can youself define the format of the data provided by the server.
The version 1.8.10 should be compatibale with 1.3.2+ inclusive 1.5.1. I hope that the most important compatibility bugs and other gugs of the new versions are fixed not. I recommend you to start with jQuery 1.5.1 but not use the features which are new in 1.5 at the begining. So you can have performace advantage of the new version and have rollback way to jQuery 1.4.4 if you will find an important bug. After testing of main features which you need you can start to use new features of jQuery 1.5.1 if needed.
Good luck
Oleg
00:17
18/08/2008
OfflineOk, following the same grid declaration above with the exception of JSON, I'm stuck yet again. I have the same structure of JSON as you do on your link but I get no error. I'll see if I can put in the loaderror you mentioend to see if I can figure out why. Below is the JSON returned by my server.
{"records": "2", "page": "1", "total": "1", "rows": [{"userid": "2", "cell": ["2", "Joe", "Dirt", "Joe@dirt.com", "dirtyboy", "Group 1", "", "1"]}, {"userid": "1", "cell": ["1", "Steffan", "Cline", "steffan@xxxxx.com", "tester", "Group 1,Group 2,Group 3,Group 4", "", "1"]}]}
00:54
10/08/2009
OfflineI have no problem with your data in the old JavaScript code. The new demo is exactly the same as I posted before, but it uses new JSON data. In the source code I changed just datatype to "json" and url to the file with JSON data.
Do you used Fiddler or Firebug to examine full headers in the server responce?
Best regards
Oleg
Most Users Ever Online: 994
Currently Online:
12 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
Log In
Home