1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /*
- * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
- *
- * http://extjs.com/license
- */
- Ext.onReady(function() {
- // create the Data Store
- var store = new Ext.data.Store({
- // load using HTTP
- url : 'sheldon.jsp?_dddc=' + allGetServerTime().getTime(),
- url : 'sheldon.xml',
- // proxy: new
- // Ext.data.ScriptTagProxy({url:'sheldon.jsp'}),
- // proxy: new Ext.data.ScriptTagProxy({url:
- // 'sheldon.jsp?_dddc='+allGetServerTime().getTime()}),
- // proxy: new Ext.data.HttpProxy({url:
- // 'sheldon.jsp'}),//...............................
- // proxy: new Ext.data.HttpProxy({url: this.url}),
- // the return will be XML, so lets set up a reader
- reader : new Ext.data.XmlReader({
- // records will have an "Item" tag
- record : 'Item',
- id : 'ASIN',
- totalRecords : '@total'
- }, [
- // set up the fields mapping into the
- // xml doc
- // The first needs mapping, the others
- // are very basic
- {
- name : 'Author',
- mapping : 'ItemAttributes > Author'
- }, 'Title', 'Manufacturer', 'ProductGroup'])
- });
- // create the grid
- var grid = new Ext.grid.GridPanel({
- store : store,
- columns : [{
- header : "Author",
- width : 120,
- dataIndex : 'Author',
- sortable : true
- }, {
- header : "Title",
- width : 180,
- dataIndex : 'Title',
- sortable : true
- }, {
- header : "Manufacturer",
- width : 115,
- dataIndex : 'Manufacturer',
- sortable : true
- }, {
- header : "Product Group",
- width : 100,
- dataIndex : 'ProductGroup',
- sortable : true
- }],
- renderTo : 'example-grid',
- width : 540,
- height : 200
- });
- store.load();
- });
|