Forum



01:20

12/04/2010

IGNORE THIS POST. I will submit a more narrowed question in a future post. (as soon as I find more hair to pull out)
I have a question!
In my jqGrid scripting and within the column model (colModel), do I need to state/list the whole xml structure even though I am not using most of the elements or even allowing them to be viewed??? In my current set up, I get the jqGrid to render and also view my column names, but absolutely no data within the grid. I am working with a static xml file that will be stored out in "never never land". Each library of my weapon groups will have many many elements within a "group" file. I only listed those elements within the colModel that I wanted to view. Do I need to list the whole xml model in the colModel?? If so, that would lead me to my second question below.
Second question: Is there a way to script a function that would modify my pre-setup jqGrid script? This way, I could have a single master configuration jqGrid.js file that I could control through another function (mainly for visibility of columns). If not, I could have upwards of 18-23 "restated" $('#targetDiv').jqGrid(function ({….. control sequences. It is going to get quite long as most of my xml files have a larger number of elements within the item model. I am trying to cut down on the download time for the .js files. My ultimate customer/user could be out in the middle of Afghanistan with very little (56K modem speed) internet access.
Here is the sample of my current data model (the smaller of the whole bunch):
<?xml version="1.0″ encoding="utf-8″ standalone="yes"?>
<chemicals>
<chemical dodic="k866″>
<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>
<objWeight measure="pound">33</objWeight>
<objHeight measure="inch">9.5</objHeight>
<objDiameter measure="inch">8.5</objDiameter>
<bodyMat>Sheet Metal</bodyMat>
<chemFillers>
<compound>Type-C HC smoke mixture
<qty measure="pound">30 slow-burning</qty>
</compound>
<compound>HC smoke mixture
<qty measure="pound">1 fast burning</qty>
</compound>
<chemFillerIgn>Flash-vented electric squibs or scratch block and match</chemFillerIgn>
</chemFillers>
<performance>
<delayTimeMin measure="second">20</delayTimeMin>
<delayTimeMax measure="second">30</delayTimeMax>
<burnTimeMin measure="minute">12</burnTimeMin>
<burnTimeMax measure="minute">22</burnTimeMax>
</performance>
<containers>
<configuration>1 smoke pot per plywood box</configuration>
<outerPackage material="plywood">
<outerLength measure="inch">>12</outerLength>
<outerWidth measure="inch">12</outerWidth>
<outerHeight measure="inch">13.25</outerHeight>
<outerWeight measure="pound">47</outerWeight>
<outerVolume measure="cubic feet">1.1</outerVolume>
</outerPackage>
<innerPackage material="plywood">
<innerLength measure=""></innerLength>
<innerHeight measure=""></innerHeight>
<innerWeight measure=""></innerWeight>
<innerVolume measure="cubic feet"></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>
Here is the controlling jqGrid script that I am working with:
$('#chem li').click(function() {
$('#searchResults').jqGrid({
url: 'weaponLib/AME_chem.xml',
datatype: 'xml',
colNames:["DODAC","NSN","Nomenclature"],
colModel:[
{name:"DODAC",index:"DODC",width:50,xmlmap:"chemical>transData>DODAC"},
{name:"NSN",index:"NSN", width:180,xmlmap:"chemical>transData>NSN"},
{name:"nomenclature",index:"nomenclature", width:100, align:"right",xmlmap:"chemical>nomenclature", sorttype:"float"}
],
height:250,
width: 700,
rowNum:10,
rowList:[10,20,30],
viewrecords: true,
loadonce: true,
xmlReader: {
root : "chemicals",
row: "chemical",
repeatitems: true,
id: "[dodic]"
},
caption: "Chemical Weapon Results"
});
$('#welcome').css('display', 'none');
$('#theGrid').css('display', 'block');
});
Any suggestions or direction would be appreciated.
Tony
13:06

Moderators
30/10/2007

Hello,
For a complex xml structure you maybe will need to set these names in colModel, but actually it depends on how your structure is organized. By example if you point in the xmlReader
to the right row structure and this structure contain only the names there is not need to do chnanges in colModel, but if your row contain another complex data - yes this is needed.
Also I think that in your example repeatitems should be set to false and not true in order this to work.
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.
Most Users Ever Online: 715
Currently Online:
63 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