3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
19 'Ext.layout.container.Border'
22 Ext.onReady(function(){
24 extend: 'Ext.data.Model',
26 // set up the fields mapping into the xml doc
27 // The first needs mapping, the others are very basic
28 {name: 'Author', mapping: 'ItemAttributes > Author'},
36 // create the Data Store
37 var store = Ext.create('Ext.data.Store', {
43 // the return will be XML, so lets set up a reader
47 totalProperty : 'total'
53 var grid = Ext.create('Ext.grid.Panel', {
56 {text: "Author", width: 120, dataIndex: 'Author', sortable: true},
57 {text: "Title", flex: 1, dataIndex: 'Title', sortable: true},
58 {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
59 {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
69 // define a template to use for the detail view
71 'Title: <a href="{DetailPageURL}" target="_blank">{Title}</a><br/>',
72 'Author: {Author}<br/>',
73 'Manufacturer: {Manufacturer}<br/>',
74 'Product Group: {ProductGroup}<br/>'
76 var bookTpl = Ext.create('Ext.Template', bookTplMarkup);
78 Ext.create('Ext.Panel', {
79 renderTo: 'binding-example',
90 bodyStyle: "background: #ffffff;",
91 html: 'Please select a book to see additional details.'
95 // update panel body on selection change
96 grid.getSelectionModel().on('selectionchange', function(sm, selectedRecord) {
97 if (selectedRecord.length) {
98 var detailPanel = Ext.getCmp('detailPanel');
99 bookTpl.overwrite(detailPanel.body, selectedRecord[0].data);