upgraded yui to 2.2.2 and yui-ext to 1.0.1a

This commit is contained in:
JT Smith 2007-07-05 04:23:55 +00:00
parent 4d9af2c691
commit 547ced6500
1992 changed files with 645731 additions and 0 deletions

View file

@ -0,0 +1,28 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Array Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC --> <!-- LIBS --> <script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script> <script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script> <!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="array-grid.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../examples.css" />
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<h1>Array Grid Example</h1>
<p>This example shows how to create a grid from Array data. For more details on this example, see <a href="http://www.jackslocum.com/yui/2006/08/30/a-grid-component-for-yahoo-ui-extensions-v1/">the blog post</a>.</p>
<p>Note that the js is not minified so it is readable. See <a href="array-grid.js">array-grid.js</a>.</p>
<!-- a place holder for the grid. requires the unique id to be passed in the javascript function, and width and height ! -->
<div id="grid-panel" style="width:600px;height:300px;">
<div id="grid-example"></div>
</div>
</body>
</html>

View file

@ -0,0 +1,112 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/
var Example = {
init : function(){
// some data yanked off the web
var myData = [
['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],
['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],
['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am'],
['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],
['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],
['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],
['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],
['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']
];
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(myData),
reader: new Ext.data.ArrayReader({}, [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
])
});
ds.load();
// example of custom renderer function
function italic(value){
return '<i>' + value + '</i>';
}
// example of custom renderer function
function change(val){
if(val > 0){
return '<span style="color:green;">' + val + '</span>';
}else if(val < 0){
return '<span style="color:red;">' + val + '</span>';
}
return val;
}
// example of custom renderer function
function pctChange(val){
if(val > 0){
return '<span style="color:green;">' + val + '%</span>';
}else if(val < 0){
return '<span style="color:red;">' + val + '%</span>';
}
return val;
}
// the DefaultColumnModel expects this blob to define columns. It can be extended to provide
// custom or reusable ColumnModels
var colModel = new Ext.grid.ColumnModel([
{header: "Company", width: 160, sortable: true, locked:false, dataIndex: 'company'},
{header: "Price", width: 75, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{id:'change',header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
{header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
{header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
]);
// create the Grid
var grid = new Ext.grid.Grid('grid-example', {
ds: ds,
cm: colModel,
autoExpandColumn: 'change'
});
var layout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(grid)]
}
}, 'grid-panel');
grid.render();
grid.getSelectionModel().selectFirstRow();
}
};
Ext.onReady(Example.init, Example);

View file

@ -0,0 +1,56 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Customizing the Grid</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC --> <!-- LIBS --> <script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script> <script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script> <!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<!--
<script type="text/javascript" src="custom-grid.js"></script>
-->
<script type="text/javascript" >
// create the property grid application (single instance)
var CustGrid = function(){
return {
init : function(){
var propsGrid;
propsGrid = new Ext.grid.PropertyGrid('props-grid', {
nameText: 'Properties Grid',
enableCtxMenu: false,
enableColumnResize: true
});
propsGrid.setSource({
"(name)": "Properties Grid",
"grouping": false,
"autoFitColumns": true,
"productionQuality": false,
"created": new Date(Date.parse('10/15/2006')),
"tested": false,
"version": .01,
"borderWidth": 1
});
propsGrid.render();
}/*init*/
};
}();
Ext.onReady(CustGrid.init, CustGrid, true);
</script>
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../examples.css" />
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<h1>Property Grid</h1>
<!-- a place holder for the grid. requires the unique id to be passed in the javascript function, and width and height ! -->
<div id="props-grid" style="overflow: hidden; width: 275px;border:1px solid #c3daf9;"></div>
</body>
</html>

View file

@ -0,0 +1,8 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

View file

@ -0,0 +1,40 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Editor Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC --> <!-- LIBS --> <script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script> <script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script> <!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="edit-grid.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../examples.css" />
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<h1>Editor Grid Example</h1>
<p>This example shows how to create a grid with inline editing. For more details on this example, see <a href="http://www.jackslocum.com/yui/2006/09/10/adding-built-in-editing-support-to-the-yahoo-ui-extensions-grid/">the blog post</a>.</p>
<p>Note that the js is not minified so it is readable. See <a href="edit-grid.js">edit-grid.js</a>.</p>
<p>The data in the grid is loaded from <a href="plants.xml">plants.xml</a>.</p>
<!-- you must define the select box here, as the custom editor for the 'Light' column will require it -->
<select name="light" id="light" style="display: none;">
<option value="Shade">Shade</option>
<option value="Mostly Shady">Mostly Shady</option>
<option value="Sun or Shade">Sun or Shade</option>
<option value="Mostly Sunny">Mostly Sunny</option>
<option value="Sunny">Sunny</option>
</select>
<div id="grid-panel" style="width:600px;height:300px;">
<div id="editor-grid"></div>
</div>
</body>
</html>

View file

@ -0,0 +1,138 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/
Ext.onReady(function(){
function formatBoolean(value){
return value ? 'Yes' : 'No';
};
function formatDate(value){
return value ? value.dateFormat('M d, Y') : '';
};
// shorthand alias
var fm = Ext.form, Ed = Ext.grid.GridEditor;
// the column model has information about grid columns
// dataIndex maps the column to the specific data field in
// the data store (created below)
var cm = new Ext.grid.ColumnModel([{
header: "Common Name",
dataIndex: 'common',
width: 220,
editor: new Ed(new fm.TextField({
allowBlank: false
}))
},{
header: "Light",
dataIndex: 'light',
width: 130,
editor: new Ed(new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:'light',
lazyRender:true
}))
},{
header: "Price",
dataIndex: 'price',
width: 70,
align: 'right',
renderer: 'usMoney',
editor: new Ed(new fm.NumberField({
allowBlank: false,
allowNegative: false,
maxValue: 10
}))
},{
header: "Available",
dataIndex: 'availDate',
width: 95,
renderer: formatDate,
editor: new Ed(new fm.DateField({
format: 'm/d/y',
minValue: '01/01/06',
disabledDays: [0, 6],
disabledDaysText: 'Plants are not available on the weekends'
}))
},{
header: "Indoor?",
dataIndex: 'indoor',
width: 55,
renderer: formatBoolean,
editor: new Ed(new fm.Checkbox())
}]);
// by default columns are sortable
cm.defaultSortable = true;
// this could be inline, but we want to define the Plant record
// type so we can add records dynamically
var Plant = Ext.data.Record.create([
// the "name" below matches the tag name to read, except "availDate"
// which is mapped to the tag "availability"
{name: 'common', type: 'string'},
{name: 'botanical', type: 'string'},
{name: 'light'},
{name: 'price', type: 'float'}, // automatic date conversions
{name: 'availDate', mapping: 'availability', type: 'date', dateFormat: 'm/d/Y'},
{name: 'indoor', type: 'bool'}
]);
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'plants.xml'}),
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have a "plant" tag
record: 'plant'
}, Plant)
});
// create the editor grid
var grid = new Ext.grid.EditorGrid('editor-grid', {
ds: ds,
cm: cm,
//selModel: new Ext.grid.RowSelectionModel(),
enableColLock:false
});
var layout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(grid)]
}
}, 'grid-panel');
// render it
grid.render();
var gridHead = grid.getView().getHeaderPanel(true);
var tb = new Ext.Toolbar(gridHead, [{
text: 'Add Plant',
handler : function(){
var p = new Plant({
common: 'New Plant 1',
light: 'Mostly Shade',
price: 0,
availDate: new Date(),
indoor: false
});
grid.stopEditing();
ds.insert(0, p);
grid.startEditing(0, 0);
}
}]);
// trigger the data store load
ds.load();
});

View file

@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>From Markup Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC --> <!-- LIBS --> <script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script> <script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script> <!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="from-markup.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../examples.css" />
<style type="text/css">
#the-table { border:1px solid #bbb;border-collapse:collapse; }
#the-table td,#the-table th { border:1px solid #ccc;border-collapse:collapse;padding:5px; }
</style>
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<h1>From Markup Grid Example</h1>
<p>This example shows how to create a grid with from an existing, unformatted HTML table.</p>
<p>Note that the js is not minified so it is readable. See <a href="from-markup.js">from-markup.js</a>.</p>
<button id="create-grid" type="button">Create grid</button>
<br />
<br />
<table cellspacing="0" id="the-table">
<thead>
<tr style="background:#eeeeee;">
<th>Name</th>
<th>Age</th>
<th>Sex</th>
</tr>
</thead>
<tbody>
<tr>
<td>Barney Rubble</td>
<td>32</td>
<td>Male</td>
</tr>
<tr>
<td>Fred Flintstone</td>
<td>33</td>
<td>Male</td>
</tr>
<tr>
<td>Betty Rubble</td>
<td>32</td>
<td>Female</td>
</tr>
<tr>
<td>Pebbles</td>
<td>1</td>
<td>Female</td>
</tr>
<tr>
<td>Bamm Bamm</td>
<td>2</td>
<td>Male</td>
</tr>
</tbody>
</table>
</body>
</html>

View file

@ -0,0 +1,90 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/
Ext.onReady(function() {
var btn = Ext.get("create-grid");
btn.on("click", function(){
btn.dom.disabled = true;
// create the grid
var grid = new Ext.grid.TableGrid("the-table");
grid.render();
}, false, {single:true}); // run once
});
/**
* @class Ext.grid.TableGrid
* @extends Ext.grid.Grid
* A Grid which creates itself from an existing HTML table element.
* @constructor
* @param {String/HTMLElement/Ext.Element} table The table element from which this grid will be created -
* The table MUST have some type of size defined for the grid to fill. The container will be
* automatically set to position relative if it isn't already.
* @param {Object} config A config object that sets properties on this grid and has two additional (optional)
* properties: fields and columns which allow for customizing data fields and columns for this grid.
* @history
* 2007-03-01 Original version by Nige "Animal" White
* 2007-03-10 jvs Slightly refactored to reuse existing classes
*/
Ext.grid.TableGrid = function(table, config) {
config = config || {};
var cf = config.fields || [], ch = config.columns || [];
table = Ext.get(table);
var ct = table.insertSibling();
var fields = [], cols = [];
var headers = table.query("thead th");
for (var i = 0, h; h = headers[i]; i++) {
var text = h.innerHTML;
var name = 'tcol-'+i;
fields.push(Ext.applyIf(cf[i] || {}, {
name: name,
mapping: 'td:nth('+(i+1)+')/@innerHTML'
}));
cols.push(Ext.applyIf(ch[i] || {}, {
'header': text,
'dataIndex': name,
'width': h.offsetWidth,
'tooltip': h.title,
'sortable': true
}));
}
var ds = new Ext.data.Store({
reader: new Ext.data.XmlReader({
record:'tbody tr'
}, fields)
});
ds.loadData(table.dom);
var cm = new Ext.grid.ColumnModel(cols);
if(config.width || config.height){
ct.setSize(config.width || 'auto', config.height || 'auto');
}
if(config.remove !== false){
table.remove();
}
Ext.grid.TableGrid.superclass.constructor.call(this, ct,
Ext.applyIf(config, {
'ds': ds,
'cm': cm,
'sm': new Ext.grid.RowSelectionModel(),
autoHeight:true,
autoWidth:true
}
));
};
Ext.extend(Ext.grid.TableGrid, Ext.grid.Grid);

View file

@ -0,0 +1,62 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/
#grid-example .x-grid-col-1 {
text-align: right;
}
#grid-example .x-grid-col-2{
text-align: right;
}
#grid-example .x-grid-col-3 {
text-align: right;
}
#grid-example .x-grid-col-4 {
text-align: right;
}
#grid-example.x-grid-mso{
border: 1px solid #6593cf;
}
#grid-example.x-grid-vista{
border: 1px solid #b3bcc0;
}
#xml-grid-example{
border: 1px solid #cbc7b8;
left: 0;
position: relative;
top: 0;
}
#xml-grid-example.x-grid-mso{
border: 1px solid #6593cf;
}
#xml-grid-example.x-grid-vista{
border: 1px solid #b3bcc0;
}
#editor-grid .x-grid-col-2{
text-align:right;
}
.x-grid-col-topic b {
font-family:tahoma, verdana;
color:#333;
display:block;
padding-left:18px;
line-height:18px;
vertical-align:middle;
background:transparent url(topic.gif) no-repeat left 1px;
}
.x-grid-col-topic b i {
font-weight:normal;
font-style: normal;
color:#000;
}
.details .x-btn-text {
background-image: url(details.gif);
}
.x-resizable-pinned .x-resizable-handle-south{
background:url(../../resources/images/default/sizer/s-handle-dark.gif);
background-position: top;
}

View file

@ -0,0 +1,36 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Paging Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC --> <!-- LIBS --> <script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script> <script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script> <!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="paging.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../examples.css" />
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<h1>Paging Grid Example</h1>
<p>This example shows how to create a grid with paging. This grid uses a ScriptTagProxy to fetch cross-domain
remote data (from the Ext forums).</p>
<p>Note that the js is not minified so it is readable. See <a href="paging.js">paging.js</a>.</p>
<div style="width:694px;" class="x-box-blue">
<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
<h3 style="margin-bottom:5px;">Ext - Help Forum</h3>
<div id="topic-grid" style="border:1px solid #99bbe8;overflow: hidden; width: 665px; height: 300px;"></div>
</div></div></div>
<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
</div>
</body>
</html>

View file

@ -0,0 +1,130 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/
Ext.onReady(function(){
// create the Data Store
var ds = new Ext.data.Store({
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.ScriptTagProxy({
url: 'http://www.yui-ext.com/forum2/topics-remote.php'
}),
// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
root: 'topics',
totalProperty: 'totalCount',
id: 'topic_id'
}, [
{name: 'title', mapping: 'topic_title'},
{name: 'author', mapping: 'username'},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
{name: 'lastPoster', mapping: 'user2'},
{name: 'excerpt', mapping: 'post_text'}
]),
// turn on remote sorting
remoteSort: true
});
ds.setDefaultSort('lastPost', 'desc');
// pluggable renders
function renderTopic(value, p, record){
return String.format('<b>{0}</b>{1}', value, record.data['excerpt']);
}
function renderTopicPlain(value){
return String.format('<b><i>{0}</i></b>', value);
}
function renderLast(value, p, r){
return String.format('{0}<br/>by {1}', value.dateFormat('M j, Y, g:i a'), r.data['lastPoster']);
}
function renderLastPlain(value){
return value.dateFormat('M j, Y, g:i a');
}
// the column model has information about grid columns
// dataIndex maps the column to the specific data field in
// the data store
var cm = new Ext.grid.ColumnModel([{
id: 'topic', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
header: "Topic",
dataIndex: 'title',
width: 420,
renderer: renderTopic,
css: 'white-space:normal;'
},{
header: "Author",
dataIndex: 'author',
width: 100,
hidden: true
},{
header: "Total Posts",
dataIndex: 'totalPosts',
width: 70,
align: 'right'
},{
id: 'last',
header: "Last Post",
dataIndex: 'lastPost',
width: 150,
renderer: renderLast
}]);
// by default columns are sortable
cm.defaultSortable = true;
// create the editor grid
var grid = new Ext.grid.Grid('topic-grid', {
ds: ds,
cm: cm,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
enableColLock:false,
loadMask: true
});
// make the grid resizable, do before render for better performance
var rz = new Ext.Resizable('topic-grid', {
wrap:true,
minHeight:100,
pinned:true,
handles: 's'
});
rz.on('resize', grid.autoSize, grid);
// render it
grid.render();
var gridFoot = grid.getView().getFooterPanel(true);
// add a paging toolbar to the grid's footer
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 25,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
// add the detailed view button
paging.add('-', {
pressed: true,
enableToggle:true,
text: 'Detailed View',
cls: 'x-btn-text-icon details',
toggleHandler: toggleDetails
});
// trigger the data store load
ds.load({params:{start:0, limit:25, forumId: 4}});
function toggleDetails(btn, pressed){
cm.getColumnById('topic').renderer = pressed ? renderTopic : renderTopicPlain;
cm.getColumnById('last').renderer = pressed ? renderLast : renderLastPlain;
grid.getView().refresh();
}
});

View file

@ -0,0 +1,327 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<plant>
<common>Bloodroot</common>
<botanical>Sanguinaria canadensis</botanical>
<zone>4</zone>
<light>Mostly Shady</light>
<price>2.44</price>
<availability>03/15/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Columbine</common>
<botanical>Aquilegia canadensis</botanical>
<zone>3</zone>
<light>Mostly Shady</light>
<price>9.37</price>
<availability>03/06/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Marsh Marigold</common>
<botanical>Caltha palustris</botanical>
<zone>4</zone>
<light>Mostly Sunny</light>
<price>6.81</price>
<availability>05/17/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Cowslip</common>
<botanical>Caltha palustris</botanical>
<zone>4</zone>
<light>Mostly Shady</light>
<price>9.90</price>
<availability>03/06/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Dutchman's-Breeches</common>
<botanical>Dicentra cucullaria</botanical>
<zone>3</zone>
<light>Mostly Shady</light>
<price>6.44</price>
<availability>01/20/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Ginger, Wild</common>
<botanical>Asarum canadense</botanical>
<zone>3</zone>
<light>Mostly Shady</light>
<price>9.03</price>
<availability>04/18/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Hepatica</common>
<botanical>Hepatica americana</botanical>
<zone>4</zone>
<light>Mostly Shady</light>
<price>4.45</price>
<availability>01/26/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Liverleaf</common>
<botanical>Hepatica americana</botanical>
<zone>4</zone>
<light>Mostly Shady</light>
<price>3.99</price>
<availability>01/02/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Jack-In-The-Pulpit</common>
<botanical>Arisaema triphyllum</botanical>
<zone>4</zone>
<light>Mostly Shady</light>
<price>3.23</price>
<availability>02/01/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Mayapple</common>
<botanical>Podophyllum peltatum</botanical>
<zone>3</zone>
<light>Mostly Shady</light>
<price>2.98</price>
<availability>06/05/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Phlox, Woodland</common>
<botanical>Phlox divaricata</botanical>
<zone>3</zone>
<light>Sun or Shade</light>
<price>2.80</price>
<availability>01/22/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Phlox, Blue</common>
<botanical>Phlox divaricata</botanical>
<zone>3</zone>
<light>Sun or Shade</light>
<price>5.59</price>
<availability>02/16/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Spring-Beauty</common>
<botanical>Claytonia Virginica</botanical>
<zone>7</zone>
<light>Mostly Shady</light>
<price>6.59</price>
<availability>02/01/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Trillium</common>
<botanical>Trillium grandiflorum</botanical>
<zone>5</zone>
<light>Sun or Shade</light>
<price>3.90</price>
<availability>04/29/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Wake Robin</common>
<botanical>Trillium grandiflorum</botanical>
<zone>5</zone>
<light>Sun or Shade</light>
<price>3.20</price>
<availability>02/21/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Violet, Dog-Tooth</common>
<botanical>Erythronium americanum</botanical>
<zone>4</zone>
<light>Shade</light>
<price>9.04</price>
<availability>02/01/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Trout Lily</common>
<botanical>Erythronium americanum</botanical>
<zone>4</zone>
<light>Shade</light>
<price>6.94</price>
<availability>03/24/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Adder's-Tongue</common>
<botanical>Erythronium americanum</botanical>
<zone>4</zone>
<light>Shade</light>
<price>9.58</price>
<availability>04/13/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Anemone</common>
<botanical>Anemone blanda</botanical>
<zone>6</zone>
<light>Mostly Shady</light>
<price>8.86</price>
<availability>12/26/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Grecian Windflower</common>
<botanical>Anemone blanda</botanical>
<zone>6</zone>
<light>Mostly Shady</light>
<price>9.16</price>
<availability>07/10/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Bee Balm</common>
<botanical>Monarda didyma</botanical>
<zone>4</zone>
<light>Shade</light>
<price>4.59</price>
<availability>05/03/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Bergamot</common>
<botanical>Monarda didyma</botanical>
<zone>4</zone>
<light>Shade</light>
<price>7.16</price>
<availability>04/27/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Black-Eyed Susan</common>
<botanical>Rudbeckia hirta</botanical>
<zone>Annual</zone>
<light>Sunny</light>
<price>9.80</price>
<availability>06/18/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Buttercup</common>
<botanical>Ranunculus</botanical>
<zone>4</zone>
<light>Shade</light>
<price>2.57</price>
<availability>06/10/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Crowfoot</common>
<botanical>Ranunculus</botanical>
<zone>4</zone>
<light>Shade</light>
<price>9.34</price>
<availability>04/03/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Butterfly Weed</common>
<botanical>Asclepias tuberosa</botanical>
<zone>Annual</zone>
<light>Sunny</light>
<price>2.78</price>
<availability>06/30/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Cinquefoil</common>
<botanical>Potentilla</botanical>
<zone>Annual</zone>
<light>Shade</light>
<price>7.06</price>
<availability>05/25/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Primrose</common>
<botanical>Oenothera</botanical>
<zone>3 - 5</zone>
<light>Sunny</light>
<price>6.56</price>
<availability>01/30/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Gentian</common>
<botanical>Gentiana</botanical>
<zone>4</zone>
<light>Sun or Shade</light>
<price>7.81</price>
<availability>05/18/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Blue Gentian</common>
<botanical>Gentiana</botanical>
<zone>4</zone>
<light>Sun or Shade</light>
<price>8.56</price>
<availability>05/02/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Jacob's Ladder</common>
<botanical>Polemonium caeruleum</botanical>
<zone>Annual</zone>
<light>Shade</light>
<price>9.26</price>
<availability>02/21/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Greek Valerian</common>
<botanical>Polemonium caeruleum</botanical>
<zone>Annual</zone>
<light>Shade</light>
<price>4.36</price>
<availability>07/14/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>California Poppy</common>
<botanical>Eschscholzia californica</botanical>
<zone>Annual</zone>
<light>Sunny</light>
<price>7.89</price>
<availability>03/27/2006</availability>
<indoor>false</indoor>
</plant>
<plant>
<common>Shooting Star</common>
<botanical>Dodecatheon</botanical>
<zone>Annual</zone>
<light>Mostly Shady</light>
<price>8.60</price>
<availability>05/13/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Snakeroot</common>
<botanical>Cimicifuga</botanical>
<zone>Annual</zone>
<light>Shade</light>
<price>5.63</price>
<availability>07/11/2006</availability>
<indoor>true</indoor>
</plant>
<plant>
<common>Cardinal Flower</common>
<botanical>Lobelia cardinalis</botanical>
<zone>2</zone>
<light>Shade</light>
<price>3.02</price>
<availability>02/22/2006</availability>
<indoor>true</indoor>
</plant>
</catalog>

View file

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2006-06-28">
<OperationRequest>
<HTTPHeaders>
<Header Name="UserAgent"
Value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.0.3705; .NET CLR 2.0.50727; .NET CLR 1.1.4322; Media Center PC 4.0; InfoPath.2)"></Header>
</HTTPHeaders>
<RequestId>18CZWZFXKSV8F601AGMF</RequestId>
<Arguments>
<Argument Name="Service" Value="AWSECommerceService"></Argument>
<Argument Name="AssociateTag" Value="ws"></Argument>
<Argument Name="SearchIndex" Value="Books"></Argument>
<Argument Name="Author" Value="Sidney Sheldon"></Argument>
<Argument Name="SubscriptionId" Value="1A7XKHR5BYD0WPJVQEG2"></Argument>
<Argument Name="Version" Value="2006-06-28"></Argument>
<Argument Name="Operation" Value="ItemSearch"></Argument>
</Arguments>
<RequestProcessingTime>1.05041599273682</RequestProcessingTime>
</OperationRequest>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Author>Sidney Sheldon</Author>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>203</TotalResults>
<TotalPages>21</TotalPages>
<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>
<Item>
<ASIN>0446613657</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446613657%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446613657%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>Are You Afraid of the Dark?</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446357421</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446357421%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446357421%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>If Tomorrow Comes</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446607207</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446607207%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446607207%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Vision</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>Tell Me Your Dreams</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446357448</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446357448%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446357448%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>Bloodline</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446532673</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446532673%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446532673%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>The Other Side of Me</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446356573</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446356573%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446356573%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>A Stranger in the Mirror</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0060198346</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0060198346%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0060198346%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>William Morrow &amp; Company</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>The Sky Is Falling</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446354732</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446354732%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446354732%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>Nothing Lasts Forever</Title>
</ItemAttributes>
</Item>
<Item>
<ASIN>0446341916</ASIN>
<DetailPageURL>
http://www.amazon.com/gp/redirect.html%3FASIN=0446341916%26tag=ws%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0446341916%253FSubscriptionId=1A7XKHR5BYD0WPJVQEG2
</DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
<Title>The Naked Face</Title>
</ItemAttributes>
</Item>
</Items>
</ItemSearchResponse>

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

View file

@ -0,0 +1,31 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>XML Grid Example</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- GC --> <!-- LIBS --> <script type="text/javascript" src="../../adapter/yui/yui-utilities.js"></script> <script type="text/javascript" src="../../adapter/yui/ext-yui-adapter.js"></script> <!-- ENDLIBS -->
<script type="text/javascript" src="../../ext-all.js"></script>
<script type="text/javascript" src="xml-grid.js"></script>
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../examples.css" />
</head>
<body>
<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->
<h1>XML Grid Example</h1>
<p>This example shows how to load a grid with XML data. For more details on this example, see <a href="http://www.jackslocum.com/yui/2006/08/31/a-grid-component-for-yahoo-ui-part-2/">the blog post</a>.</p>
<p>This grid also uses autoHeight and autoWidth to dynamically size to fit it's data and columns.</p>
<p>Note that the js is not minified so it is readable. See <a href="xml-grid.js">xml-grid.js</a>.</p>
<p>The data in the grid is loaded from <a href="sheldon.xml">sheldon.xml</a>, which is directly from an Amazon.com search.</p>
<!-- a place holder for the grid. requires the unique id to be passed in the javascript function, and width and height ! -->
<div id="example-grid" class="x-grid-mso" style="border: 1px solid #c3daf9; overflow: hidden; width:520px;"></div>
</body>
</html>

View file

@ -0,0 +1,46 @@
/*
* Ext JS Library 1.0.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/
Ext.onReady(function(){
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'sheldon.xml'}),
// 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'
])
});
var cm = new Ext.grid.ColumnModel([
{header: "Author", width: 120, dataIndex: 'Author'},
{header: "Title", width: 180, dataIndex: 'Title'},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer'},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup'}
]);
cm.defaultSortable = true;
// create the grid
var grid = new Ext.grid.Grid('example-grid', {
ds: ds,
cm: cm
});
grid.render();
ds.load();
});