Forum



18:48

12/04/2010

Newbie here.
What is the difference between the attribute name and index within the colModel? I am having issues with targeting 3rd and 4th tree levels within my static xml files. Here is part of my xml:
<smallArms>
<bullet saId="1">
<DODIC>A085</DODIC>
<size>22 cal</size>
<nomenclature>CARTRIDGE, CALIBER .22 CAL SHORT, BLANK</nomenclature>
<use>Used by .22 caliber starter pistols.</use>
<description>Identified by its short brass case, no projectile and rimfire primer.</description>
<objLength>
<value></value>
<unit></unit>
</objLength>
<objWidth>
<value></value>
<unit></unit>
</objWidth>
<objHeight>
<value></value>
<unit></unit>
</objHeight>
.....
I am needing to individually target, say the value or unit elements from objLength level. but my jqGrid setup grid dies when it gets to this part (onSelectRow operation). So I am thinking that it may be due to a index or name conflict within the colModel. jqGrid operates just fine as long as I don't try and do something with something at the level of <value> or <unit>. Do I need to make the index values within colModel explicitly unique within the whole colModel?? Right now, my colModel has value and unit levels the same name even though they are subvalues of different elements. Here is part of my jqGrid set-up:
{name:"dodic",index:"dodic", xmlmap:"DODIC", width:30, align:"center", search: true, stype:"text", label: "DODIC"},
{name:"size", index:"size", xmlmap:"size",width:30, align:"center", search: true, stype: "float", label: "Size/Caliber"},
{name:"nomenclature",index:"nomenclature", xmlmap:"nomenclature", width:120, align:"left", search: false, sorttype: "text", label: "Nomenclature"},
{name:"used", index:"used",xmlmap:"used", width:120,align:"left",search:false,sorttype:"text", label:"Use", hidden: true},
{name:"description", index:"description", xmlmap:"description",width:120, align:"center", search: false, stype: "float", hidden: true, label: 'Description'},
{name:"objLengthvalue", index:"value", xmlmap:"objLength>value",width:30, align:"center", search: false, stype: "text", hidden: true},
{name:"objLengthunit", index:"unit", xmlmap:"objLength>unit",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Width'},
{name:"objWidthvalue", index:"value", xmlmap:"objWidth>value",width:30, align:"center", search: false, stype: "float", hidden: true},
{name:"objWidthunit", index:"unit", xmlmap:"objWidth>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
{name:"objHeightvalue", index:"value", xmlmap:"objHeight>value",width:30, align:"center", search: false, stype: "float", hidden: true},
{name:"objHeightunit", index:"unit", xmlmap:"objHeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
My onSelectRow operates just fine until I try and do something like pull data from say objLength for value and unit and display it in a div. here is my onSelectRow operation from my jqGrid set up:
var gsr = $('#searchResults').jqGrid('getGridParam', 'selrow');
if (gsr) {
var data = $('#searchResults').jqGrid('getRowData', gsr);
$('#basicMun #dodic').append('DODIC: ' + data.dodic);
$('#basicMun #title').append('Nomenclature: ' + data.nomenclature);
$('#basicMun #use').append('Use: ' + data.use);
$('#basicMun #description').append('Description: ' + data.description);
/******Below is where my code is breaking -- What the heck*************/
$('#basicMun #objLength').append('Length: ' + data.objLength.value + ' ' + data.objLength.unit);
$('#basicMun #objWidth').append('Width: ' + data.objWidth.value + ' ' + data.objWidth.unit);
$('#basicMun #objHeight').append('Height: ' + data.objHeight.value + ' ' + data.objHeight.unit);
$('#basicMun #objDiameter').append('Diameter: ' + data.objDiameter.value + ' ' + data.objDiameter.unit);
$('#basicMun #objWeight').append('Weight: ' + data.objWeight.value + ' ' + data.objWeight.unit);
Tony
19:11

Moderators
30/10/2007

Hello,
Did you have consult the docs regrading this?
http://www.trirand.com/jqgridw.....el_options
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.
20:09

12/04/2010

Good Morning Tony,
Yes, I did read it. That was why I was asking for clarification.
Since my earlier post, I have went back into my colModel and made both name and index unique through out the whole colModel. My thinking was that I might have a conflict somewhere in there. Come to find out, that did not change my outcome.
I finally got it to work. I uploaded the whole project to a outside web space that we have. I cleared my IE cache (several times). I did a voodoo dance over IE.
Now everything works. What craziness!
but it was your suggestion that did give me insight. Thanks.
Tony
23:47

19/05/2010

The index is the key in the database used for certain operations (like searching). For example, I have a status_id column in one table that is mapped via a join to get the status name from the status table (i.e. table.status_id is a foreign key). Then, for searching, I have jqGrid create a dropdown of statuses that can be searched on. When jqGrid submits the request to the PHP script, instead of asking for status='blah' (for example), it would say status_id = 1 (assuming status_id was set as the index, and blah = 1 in the status table). Does that help?
Most Users Ever Online: 715
Currently Online:
138 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