Forum



17:15

12/04/2010

I finally was able to put into reality what the documentation is saying about xmlReader's repeatitems option.
If you have the repeatitems set to true, this takes over the presentation of data – no matter what you have stated in the colModel. See my sample code below. If you have repeatitems set to true, you MUST include the cell option in xmlReader, otherwise there is no data rendered.
This all came about while trying to get my own static xml file to render in jqGrid. Nothing was working. So I went back and started trail/error testing with a sample xml file (MSDN).
Here is my jqGrid script:
url: 'weaponLib/booksSampleXML_work.xml',
datatype: 'xml',
colNames:["Author","Title", "Price", "Description"],
colModel:[
{name:"Author",index:"Author", width:90, xmlmap:"author"},
{name:"Title",index:"Title", width:120,xmlmap:"title"},
{name:"Price",index:"Price", width:65, align:"right",xmlmap:"price", sorttype:"float"},
{name:"Description",index:"Description", width:100, align:"left",xmlmap:"description"}
],
height:250,
width: 750,
rowNum:10,
rowList:[10,20,30],
viewrecords: true,
loadonce: true,
xmlReader: {
root : "catalog",
row: "book",
repeatitems: true,
cell:"invcell",
id:"numbr"
},
caption: "Chemical Weapon Results",
pager: '#gridNavBar'
});
here is the sample xml file:
<book numbr='1'>
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publisher>
<name>Wrox</name>
<publish_date>2000-10-01</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book numbr='2'>
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publisher>
<name>PackIt</name>
<publish_date>2000-12-16</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<book numbr='3'>
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publisher>
<name>PackIt</name>
<publish_date>2000-11-17</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
</book>
<book numbr='4'>
<author>Corets, Eva</author>
<title>Oberon's Legacy</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publisher>
<name>Wrox</name>
<publish_date>2001-03-10</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>In post-apocalypse England, the mysterious
agent known only as Oberon helps to create a new life
for the inhabitants of London. Sequel to Maeve
Ascendant.</description>
</book>
<book numbr='5'>
<author>Corets, Eva</author>
<title>The Sundered Grail</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publisher>
<name>Focal Press</name>
<publish_date>2001-09-10</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy.</description>
</book>
<book numbr='6'>
<author>Randall, Cynthia</author>
<title>Lover Birds</title>
<genre>Romance</genre>
<price>4.95</price>
<publisher>
<name>Sybex</name>
<publish_date>2000-09-02</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>When Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled.</description>
</book>
<book numbr='7'>
<author>Thurman, Paula</author>
<title>Splish Splash</title>
<genre>Romance</genre>
<price>4.95</price>
<publisher>
<name>Wrox</name>
<publish_date>2000-11-02</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>A deep sea diver finds true love twenty
thousand leagues beneath the sea.</description>
</book>
<book numbr='8'>
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
<publisher>
<name>PackIt</name>
<publish_date>2000-12-06</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>An anthology of horror stories about roaches,
centipedes, scorpions and other insects.</description>
</book>
<book numbr='9'>
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publisher>
<name>Focal Press</name>
<publish_date>2000-11-02</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems
of being quantum.</description>
</book>
<book numbr='10'>
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
<publisher>
<name>Focal Press</name>
<publish_date>2000-11-02</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>Microsoft's .NET initiative is explored in
detail in this deep programmer's reference.</description>
</book>
<book numbr='11'>
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>36.95</price>
<publisher>
<name>Focal Press</name>
<publish_date>2000-11-02</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>The Microsoft MSXML3 parser is covered in
detail, with attention to XML DOM interfaces, XSLT processing,
SAX and more.</description>
</book>
<book numbr='12'>
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>49.95</price>
<publisher>
<name>Sybex</name>
<publish_date>2000-11-02</publish_date>
</publisher>
<invcell>1</invcell>
<invcell>2</invcell>
<invcell>3</invcell>
<description>Microsoft Visual Studio 7 is explored in depth,
looking at how Visual Basic, Visual C++, C#, and ASP+ are
integrated into a comprehensive development
environment.</description>
</book>
</catalog>
14:36

Moderators
30/10/2007

Hello,
In your example repeatitems is set to true. In order to work set it to false and set the id to be attribute:
xmlReader: {
root : "catalog",
row: "book",
repeatitems: false,
cell:"invcell",
id:"[numbr]"
},
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:
72 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