Forum
19:06
12/04/2010
Ok, I have tried this multiple ways and I still can not render any data into the grid. I know that jqgrid is finding my xml file because firebug says so and also my column names are being rendered. I have tried each version in both FF3 and IE7/8 with same result. Can someone tell me what I am doing wrong??
script for jqgrid:
$('#searchResults').jqGrid({
url: 'weaponLib/chemTest1.xml',
datatype: 'xml',
colNames:["DODIC","NSN","Nomenclature"],
colModel:[
{name:"dodic",index:"dodic",width:15,xmlmap:"chemicals>chemical>dodic"},
{name:"NSN",index:"NSN", width:180,xmlmap:"chemicals>chemical>transData>NSN"},
{name:"nomenclature",index:"nomenclature", width:100, align:"right",xmlmap:"chemicals>chemical>nomenclature", sorttype:"float"}
],
autowidth: true,
rowNum:10,
rowList:[10,20,30],
viewrecords: true,
loadonce: true,
xmlReader: {
root : "chemicals",
row: "chemical",
},
caption: "Chemical Weapon Results",
pager: '#gridNavBar'
});
I have tried it with a xmlReader id and without an id. I have tried stating the whole xml map, but jqgrid tells me that the number of colNames does not match the number of items in the colModel. I reworked my xml structure so that the id was associated with a element that I would never display. I also removed all of the element attributes and made them their own elements (so that I can later change between metric and english measurements).
So what gives????
Here is my xml model:
<chemicals>
<chemical chemId="1">
<dodic>k866</dodic>
<weaponType>smoke</weaponType>
<nomenclature>Smoke Pot: HC, 30-Pound, ABC-M5</nomenclature>
<use>To produce screening smoke for training exercises and demonstrations, but can also be used in combat.</use>
<description>The ABC-M5 smoke pot is a cylindrical sheetmetal container, filled with about 30 pounds of slowburning, type-C, HC smoke mixture and 1 pound of fast-burning, HC smoke mixture. A carrying handle is mounted on the outer cover.</description>
<objLength>
<value></value>
<unit></unit>
</objLength>
<objWidth>
<value></value>
<unit></unit>
</objWidth>
<objHeight>
<value>9.5</value>
<unit>inch</unit>
</objHeight>
<objDiameter>
<value>8.5</value>
<unit>inch</unit>
</objDiameter>
<objWeight>
<value>33</value>
<unit>pound</unit>
</objWeight>
<bodyMat>Sheet Metal</bodyMat>
<chemFillers>
<compound>
<substance>Type-C HC smoke mixture</substance>
<value>30</value>
<subvalue>slow-burning</subvalue>
<unit>pound</unit>
</compound>
<compound>HC smoke mixture
<substance>HC smoke mixture</substance>
<value>1</value>
<subvalue>fast burning</subvalue>
<unit>pound</unit>
</compound>
<chemFillerIgn>Flash-vented electric squibs or scratch block and match</chemFillerIgn>
</chemFillers>
<performance>
<delayTimeMin>
<value>20</value>
<unit>second</unit>
</delayTimeMin>
<delayTimeMax>
<value>30</value>
<unit>second</unit>
</delayTimeMax>
<burnTimeMin>
<value>12</value>
<unit>minute</unit>
</burnTimeMin>
<burnTimeMax>
<value>22</value>
<unit>minute</unit>
</burnTimeMax>
</performance>
<containers>
<configuration>1 smoke pot per plywood box</configuration>
<outerPackage>
<material>plywood</material>
<outerLength>
<value>12</value>
<unit>inch</unit>
</outerLength>
<outerWidth>
<value>12</value>
<unit>inch</unit>
</outerWidth>
<outerHeight>
<value>13.5</value>
<unit>inch</unit>
</outerHeight>
<outerDiameter>
<value></value>
<unit></unit>
</outerDiameter>
<outerWeight>
<value>47</value>
<unit>pound</unit>
</outerWeight>
<outerVolume>
<value>1.1</value>
<unit>cubic feet</unit>
</outerVolume>
</outerPackage>
<innerPackage>
<material></material>
<innerLength>
<value></value>
<unit></unit>
</innerLength>
<innerWidth>
<value></value>
<unit></unit>
</innerWidth>
<innerHeight>
<value></value>
<unit></unit>
</innerHeight>
<innerDiameter>
<value></value>
<unit></unit>
</innerDiameter>
<innerWeight>
<value></value>
<unit></unit>
</innerWeight>
<innerVolume>
<value></value>
<unit></unit>
</innerVolume>
</innerPackage>
</containers>
<transData>
<UNOsn>0016</UNOsn>
<UNOpsn>Smoke Pots</UNOpsn>
<qdClassSCG>1.3G</qdClassSCG>
<DOTclass>C</DOTclass>
<DOTlabel>Explosive C</DOTlabel>
<DODAC>1365-K866</DODAC>
<NSN>1365-00-598-5207</NSN>
<dwgNumber>36-1-18</dwgNumber>
</transData>
<references>
<publication>FM 3-50</publication>
<publication>SB 3-30-153</publication>
<publication>SC1340/98-IL</publication>
<publication>TM CML 100</publication>
</references>
<siterefs>
<publication>TM 43-0001-26-2
<onlineLoc>logsa.army.mil</onlineLoc>
</publication>
<publication>DAC Conventional Ammunition Packaging Unit Load Data Index (CAPULDI)
<onlineLoc>logsa.army.mil</onlineLoc>
</publication>
</siterefs>
<media>
<photo>
<pic></pic>
<pic></pic>
</photo>
<aReality>
<anim></anim>
<anim></anim>
</aReality>
</media>
</chemical>
</chemicals>
respectfully,
Tony
13:58
Moderators
30/10/2007
Hello,
In xmlReader set repeatitems to false. (the default is true)
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:24
12/04/2010
Tony,
I finally got the grid to render actual real data this weekend. After playing with 'switch' settings and alot of trial and error. I also restructured the xml file to be more standard across my application. All of the id's are removed with exception of the item id (in the case above would be "chemId"). I reread the API documentation and found that I can not make use of any xml element attributes except for something like an ID which will never be displayed or rendered. This restructuring made my xml files alot bigger (both in lines of code and size of file); i.e., my small arms xml library became over 16,100 lines long and about .5mb big. The file size will grow as data to the elements gets added. Maybe I have enough power now to convence my client to go JSON vice xml.
Thank you for the help.
Tony
Most Users Ever Online: 715
Currently Online:
31 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