Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / xml-grid.html
diff --git a/docs/source/xml-grid.html b/docs/source/xml-grid.html
new file mode 100644 (file)
index 0000000..e0ce739
--- /dev/null
@@ -0,0 +1,47 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js">Ext.onReady(function(){\r
+\r
+    // create the Data Store\r
+    var store = new Ext.data.Store({\r
+        // load using HTTP\r
+        url: 'sheldon.xml',\r
+\r
+        // the return will be XML, so lets set up a reader\r
+        reader: new Ext.data.XmlReader({\r
+               // records will have an "Item" tag\r
+               record: 'Item',\r
+               id: 'ASIN',\r
+               totalRecords: '@total'\r
+           }, [\r
+               // set up the fields mapping into the xml doc\r
+               // The first needs mapping, the others are very basic\r
+               {name: 'Author', mapping: 'ItemAttributes > Author'},\r
+               'Title', 'Manufacturer', 'ProductGroup'\r
+           ])\r
+    });\r
+\r
+    // create the grid\r
+    var grid = new Ext.grid.GridPanel({\r
+        store: store,\r
+        columns: [\r
+            {header: "Author", width: 120, dataIndex: 'Author', sortable: true},\r
+            {header: "Title", width: 180, dataIndex: 'Title', sortable: true},\r
+            {header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},\r
+            {header: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}\r
+        ],\r
+        renderTo:'example-grid',\r
+        width:540,\r
+        height:200\r
+    });\r
+\r
+    store.load();\r
+});\r
+</pre>    \r
+</body>\r
+</html>
\ No newline at end of file