Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Selecting Row and pushing full data set (not just what is in colModel) to accordion
27/04/2010
16:15
Avatar
Energetic Pixels
Lexington, OK, USA
Member
Members
Forum Posts: 40
Member Since:
12/04/2010
sp_UserOfflineSmall Offline

Ok, I finally have my jqGrid working with itself and with web site menu.

but I want to be able to select a row and then push the full data set (within the xml library file) to something like an accordion.  I have modified my jqGrid for "bullets" in the following code to look for a row selection.  But I am lost after that.  I believe if I keep going down this avenue, I will only be working with whatever selected elements are in the colModel.  I need to push more than that to the accordion.  Am I anywhere near on track for the selectrow???

$('#bullet').click(function() {
        $('#searchResults').jqGrid('GridUnload');
        $('#searchResults').jqGrid({
            url: 'weaponLib/AME_sa-bullet.xml',
            datatype: 'xml',
            colNames:["DODIC","NSN", "Size/Caliber", "Nomenclature"],
            colModel:[
                {name:"dodic",index:"dodic", xmlmap:"DODIC", width:30, align:"center", search: true, stype:"text"},
                {name:"NSN",index:"NSN", xmlmap:"transData>NSN", width:40, align:"center", search: true, stype: "float"},
                {name:"size", index:"size", xmlmap:"size",width:30, align:"center", search: true, stype: "float"},
                {name:"nomenclature",index:"nomenclature", xmlmap:"nomenclature", width:120, align:"left", search: false, sorttype: "text"}
                ],
            height:250,
            width: 900,
            viewrecords: true,
            xmlReader: {
                root : "smallArms",
                row: "bullet",
                repeatitems: false,
                id: "[saId]"
                },
            /*onSelectRow: function() {
                var id = $('#bullet').jqGrid('getGridParam','selrow');
                if (id) { var ret = $('#bullet').jqGrid('getRowData',id);
                alert("id="+ret.id+" invdate="+ret.invdate+"...");
                },*/
            sortname: 'dodic',
            rowNum: -1,
            altRows: true,
            pager: '#gridNavBar',
            caption: "Bullet Results"
        });
        $('#searchResults').jqGrid('navGrid', '#gridNavBar', {search: true, edit: false, del: false, add: false});
        $('#welcome').css('display', 'none');
        $('#theGrid').css('display', 'inline');
    });

Here is the online address to what I have so far.  Please forgive how the grid pops up after selecting bullets (under Small Arms menu item).  I will fix that after I get data moving to the accordion.

TonyConfused

06/05/2010
14:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Sorry I do not understand. In onselectRow you have all the data as object, you can then serialize this data and send it to the accordion, if I understand right.

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.

06/05/2010
18:44
Avatar
Energetic Pixels
Lexington, OK, USA
Member
Members
Forum Posts: 40
Member Since:
12/04/2010
sp_UserOfflineSmall Offline

Tony,

Thank you for the help.  Between now and when I posted that 'query', I figured out some things and finally got it to work.  I just don't know if my working script is too verbose (maybe I took the long way to do something simple) or right on the money.

   My new onSelectRow is:

 

onSelectRow: function() {
      var gsr = $('#searchResults').jqGrid('getGridParam', 'selrow');
      if (gsr) {
            var data = $('#searchResults').jqGrid('getRowData', gsr);
            alert(data.description);
       };

But when a person is asking for a specific data node in the sample alert statement above, they must have described it in the colModel.  I tried multiple variations between this selectrow code and my colModel.  The only time that I could get a proper response was when the data node had specified that particular node in the colModel. The following is one of my jqGrid models.  I am in the process of developing 9 other required grids for my application (just about equal to the number of menu items I have).  Each grid is somewhat like the others, with exception of the specific munition element.  Most of them will list the same elements that describe shipping and storage information, publication/media information and the nodes that are described in the first 14 lines of my column model.  Everything outside of those just mentioned will change depending on what kind of object I am trying to describe.  Like some of my data nodes will not have a tracerWeightvalue, primerunit, etc.   What really sucks about this application is that I don't have the benefit of working with a true database and middle tier engine (asp, php, java, etc).

Also, is there a way to get rid of the paging notation in the 'footer' (middle of the footer) of the grid but keep the display of the number of records that appears on the right side of the footer???  If you would like to take a peek at my grid as it stands today, I have uploaded current working scripting back to the website I mentioned in original post above.

TonySmile

$('#bullet').click(function() {
    $('#left').hide('fast');
    $('#right').hide('fast');
    $('#searchResults').jqGrid('GridUnload');
    $('#searchResults').jqGrid({
       url: 'weaponLib/AME_sa-bullet.xml',
       datatype: 'xml',
       colNames:[],
       colModel:[
          {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:"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},
          {name:"objDiavalue", index:"value", xmlmap:"objDiameter>value",width:30, align:"center", search: false, stype: "float", hidden: true},
          {name:"objDiaunit", index:"unit", xmlmap:"objDiameter>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"objWeightvalue", index:"value", xmlmap:"objWeight>value",width:30, align:"center", search: false, stype: "float", hidden: true},
          {name:"objWeightunit", index:"unit", xmlmap:"objWeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"bodyMat", index:"bodyMat", xmlmap:"bodyMat",width:30, align:"center", search: false, stype: "float", hidden: true, label: 'Body Material'},
          {name:"fusesubstance", index:"substance", xmlmap:"fuse>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Fuse Composition'},
          {name:"fusevalue", index:"value", xmlmap:"fuse>value",width:30, align:"center", search: false, stype: "float", hidden: true},
          {name:"fuseunit", index:"unit", xmlmap:"fuse>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"primersubstance", index:"substance", xmlmap:"primer>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Primer Composition'},
          {name:"primervalue", index:"value", xmlmap:"primer>value",width:30, align:"center", search: false, stype: "float", hidden: true},
          {name:"primerunit", index:"unit", xmlmap:"primer>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"projWeightvalue", index:"value", xmlmap:"projectile>objWeight>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"projWeightunit", index:"unit", xmlmap:"projectile>objWeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"projMatsubstance", index:"substance", xmlmap:"projectile>objMat>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Projectile Composition'},
          {name:"projMatvalue", index:"value", xmlmap:"projectile>objMat>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"projMatunit", index:"unit", xmlmap:"projectile>objMat>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"tracerWeightvalue", index:"value", xmlmap:"tracer>objWeight>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"tracerWeightunit", index:"unit", xmlmap:"tracer>objWeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"tracerMatsubstance", index:"substance", xmlmap:"tracer>objMat>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Tracer Composition'},
          {name:"tracerMatvalue", index:"value", xmlmap:"tracer>objMat>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"tracerMatunit", index:"unit", xmlmap:"tracer>objMat>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"explossubstance", index:"substance", xmlmap:"explosive>compound>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Explosive Composition'},
          {name:"explosWeightvalue", index:"value", xmlmap:"explosive>compound>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"explosWeightunit", index:"unit", xmlmap:"explosive>compound>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"incendiarysubstance", index:"substance", xmlmap:"incendiary>compound>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Incendiary Composition'},
          {name:"incendiaryWeightvalue", index:"value", xmlmap:"incendiary>compound>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"incendiaryWeightunit", index:"unit", xmlmap:"incendiary>compound>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"propsubstance", index:"substance", xmlmap:"propellant>compound>substance",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Propellant Composition'},
          {name:"propWeightvalue", index:"value", xmlmap:"propellant>compound>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"propWeightunit", index:"unit", xmlmap:"propellant>compound>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"velocityvalue", index:"value", xmlmap:"performance>velocity>value",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Velocity/Speed'},
          {name:"velocityunit", index:"unit", xmlmap:"performance>velocity>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"distancevalue", index:"value", xmlmap:"performance>distance>value",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Maximum Distance'},
          {name:"distanceunit", index:"unit", xmlmap:"performance>distance>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"pressurevalue", index:"value", xmlmap:"performance>chamberPressure>value",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Chamber Pressure'},
          {name:"pressureunit", index:"unit", xmlmap:"performance>chamberPressure>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"configuration", index:"configuration", xmlmap:"containers>configuration",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Packaging Configuration'},
          {name:"OPmaterial", index:"material", xmlmap:"containers>outerPackage>material",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Outer Package Material'},
          {name:"OPlengthvalue", index:"value", xmlmap:"containers>outerPackage>outerLength>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPlengthunit", index:"unit", xmlmap:"containers>outerPackage>outerWidth>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPwidthvalue", index:"value", xmlmap:"containers>outerPackage>outerWidth>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPwidthunit", index:"unit", xmlmap:"containers>outerPackage>outerWidth>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPheightvalue", index:"value", xmlmap:"containers>outerPackage>outerHeight>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPheightunit", index:"unit", xmlmap:"containers>outerPackage>outerHeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPdiavalue", index:"value", xmlmap:"containers>outerPackage>outerDiameter>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPdiaunit", index:"unit", xmlmap:"containers>outerPackage>outerDiameter>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPweightvalue", index:"value", xmlmap:"containers>outerPackage>outerWeight>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPweightunit", index:"unit", xmlmap:"containers>outerPackage>outerWeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"OPvolumevalue", index:"value", xmlmap:"containers>outerPackage>outerVolume>value",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Outer Package Volume'},
          {name:"OPvolumeunit", index:"unit", xmlmap:"containers>outerPackage>outerVolume>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPmaterial", index:"material", xmlmap:"containers>innerPackage>material",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Inner Package Material'},
          {name:"IPlengthvalue", index:"value", xmlmap:"containers>innerPackage>innerLength>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPlengthunit", index:"unit", xmlmap:"containers>innerPackage>innerLength>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPwidthvalue", index:"value", xmlmap:"containers>innerPackage>innerWidth>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPwidthunit", index:"unit", xmlmap:"containers>innerPackage>innerWidth>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPheightvalue", index:"value", xmlmap:"containers>innerPackage>innerHeight>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPheightunit", index:"unit", xmlmap:"containers>innerPackage>innerHeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPdiavalue", index:"value", xmlmap:"containers>innerPackage>innerDiameter>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPdiaunit", index:"unit", xmlmap:"containers>innerPackage>innerDiameter>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPweightvalue", index:"value", xmlmap:"containers>innerPackage>innerWeight>value",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPweightunit", index:"unit", xmlmap:"containers>innerPackage>innerWeight>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"IPvolumevalue", index:"value", xmlmap:"containers>innerPackage>innerVolume>value",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Inner Package Volume'},
          {name:"IPvolumeunit", index:"unit", xmlmap:"containers>innerPackage>innerVolume>unit",width:30, align:"center", search: false, stype: "text", hidden: true},
          {name:"UNOsn", index:"UNOsn", xmlmap:"transData>UNOsn",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'UN Serial Number'},
          {name:"UNOpsn", index:"UNOpsn", xmlmap:"transData>UNOpsn",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'UN Proper Shipping Name'},
          {name:"HCD", index:"HCD", xmlmap:"transData>qdClassSCG",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Hazard Class/Division'},
          {name:"DOTclass", index:"DOTclass", xmlmap:"transData>DOTclass",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'US DOT Class'},
          {name:"DOTlabel", index:"DOTlabel", xmlmap:"transData>DOTlabel",width:120, align:"center", search: false, stype: "text", hidden: true, label: 'US DOT Label'},
          {name:"DODAC", index:"DODAC", xmlmap:"transData>DODAC",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'DODAC'},
          {name:"NSN",index:"NSN", xmlmap:"transData>NSN", width:40, align:"center", search: true, stype: "float", hidden: true, label: 'US National Stock Number'},
          {name:"dwgNumber", index:"dwgNumber", xmlmap:"transData>dwgNumber",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Engineer Drawing Number'},
          {name:"refpublication", index:"publication", xmlmap:"references>source>publication",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Item Reference Publication'},
          {name:"refonlineLoc", index:"onlineLoc", xmlmap:"references>source>onlineLoc",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Item Reference Online Location'},
          {name:"sitepublication", index:"publication", xmlmap:"siterefs>source>publication",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Site Reference Publication'},
          {name:"siteonlineLoc", index:"onlineLoc", xmlmap:"siterefs>source>onlineLoc",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Site Reference Online Location'},
          {name:"piclocation", index:"location", xmlmap:"media>photo>pic>location",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Photo Location'},
          {name:"piccaption", index:"caption", xmlmap:"media>photo>pic>caption",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Photo Caption'},
          {name:"pictitle", index:"title", xmlmap:"media>photo>pic>title",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Photo Title'},
          {name:"animlocation", index:"location", xmlmap:"media>aReality>anim>location",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Augmented Reality Location'},
          {name:"animcaption", index:"caption", xmlmap:"media>aReality>anim>caption",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Augmented Reality Caption'},
          {name:"animtitle", index:"title", xmlmap:"media>aReality>anim>title",width:30, align:"center", search: false, stype: "text", hidden: true, label: 'Augmented Reality Title'}
           ],
       height:250,
       width: 900,
       viewrecords: true,
       xmlReader: {
          root : "smallArms",
          row: "bullet",
          repeatitems: false,
          id: "[saId]"
          },
       onSelectRow: function() {
           var gsr = $('#searchResults').jqGrid('getGridParam', 'selrow');
           if (gsr) {
               var data = $('#searchResults').jqGrid('getRowData', gsr);
               alert(data.description);
             };
       $('#theGrid').hide();
       $('#weapon #left').show('fast');
       $('#weapon #right').show('fast');
       },
    sortname: 'dodic',
    rowNum: -1,
    altRows: true,
    pager: '#gridNavBar',
    caption: "Bullet Results"
   });
   $('#searchResults').jqGrid('navGrid', '#gridNavBar', {search: true, edit: false, del: false, add: false,   refresh: false});
   $('#welcome').hide('slow');
   $('#theGrid').show('fast');
});
Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information