PDA

View Full Version : Fields mapping in Grid's XmlReader



eddyyanto
29 May 2007, 10:01 PM
Hi,

Been experimenting with the Grid of the extjs, all I can say that is I am a bit stuck with the fields mapping in the Grid. From the tutorials and the docs, I can see that the mapping is two level deep that :



<Item>
<ASIN>0446355453</ASIN>

<DetailPageURL>

http://www.amazon.com/gp/redirect.html%3FASIN=0446355453%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446355453%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2

</DetailPageURL>

<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>Master of the Game</Title>
</ItemAttributes>
</Item>


and from the docs



var myReader = new Ext.data.XmlReader({
record: "row", // The repeated element which contains record information
totalRecords: "results", // The element which contains the number of returned records (optional)
id: "id" // The element within the record that provides an ID for the record (optional)
}, myRecordDefinition);


How do I do a simple mapping to the following xml?



<Questionnaires>
<Questionnaire>
<Id>13</Id>
<Date>2007-05-29</Date>
<Gender>M</Gender>
<Age>20</Age>
<Major>major</Major>
<Comment>comment</Comment>
</Questionnaire>
.
.
.
<Questionnaires>

Animal
29 May 2007, 11:20 PM
Which bit of that documentation is incomprehensible? It seems totally clear from that what you must do.

eddyyanto
30 May 2007, 4:17 AM
Sorry, I admit I was a bit clumsy at code sometimes. --"
Given the examples and documentations, it should be clear and now I know how simple what I was trying to achieve. Thanks Animal... :)