ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: lgauton on March 13, 2014, 09:10:09 pm

Title: Grids populated with XML data
Post by: lgauton on March 13, 2014, 09:10:09 pm
Hi

I have a number of XML documents that I want to populate grids with, the documents are all similar to this structure

<?xml version="1.0"?>
<ArrayOfContact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Contact>
   <id xmlns="http://xxxxxx.co.uk/td2/frontend/contractsmanager">116035291</id>
   <type xmlns="http://xxxxxx.co.uk/td2/frontend/contractsmanager">
      <code>COMMMANGER</code>
      <description>Commercial Manager</description>
   </type>
   <name xmlns="http://xxxxxx.co.uk/td2/frontend/contractsmanager">Mr Francis Drake</name>
</Contact>
<Contact>
   <id xmlns="http://xxxxxx.co.uk/td2/frontend/contractsmanager">116035292</id>
   <type xmlns="http://xxxxxx.co.uk/td2/frontend/contractsmanager">
      <code>DUTYOFF</code>
      <description>Duty Officer</description>
   </type>
   <name xmlns="http://xxxxxx.co.uk/td2/frontend/contractsmanager">Miss Katie Price</name>
</Contact>
</ArrayOfContact>

the xml populates OK (see attached grid), except for lookup type fields as example 'type' above where the xml gives both code and description, xml definition I use in the grid is

var obj = { itemParent: "Contact", itemNames: ["id", "type", "name"] };

var colModel = [
                { title: "ID", dataType: "string", width: "75", dataIndx: 0 },
                { title: "Type", dataType: "string", width: "250", dataIndx: 1 },
                { title: "Name", dataType: "string", width: "250", dataIndx: 2 }
                ];

is there a way I can either

1. Change the xml definition to handle the lookup fields, better and be able to reference the 'code' and 'description'
2. Extract from current grid just the part relating to the 'code' element

Thanks

Title: Re: Grids populated with XML data
Post by: paramvir on March 13, 2014, 11:40:57 pm
you can still reference code and description as:

var obj = { itemParent: "Contact", itemNames: ["id", "type", "name", "code", "description" ] };