Code:
Ext.Loader.setConfig({
enabled : true,
paths : {
'Ext.ux.touch.grid': './Ext.ux.touch.grid'
}
});
Ext.require([
'Ext.tab.Panel',
'Ext.field.Select',
'Ext.ux.touch.grid.List',
'Ext.ux.touch.grid.feature.Feature',
'Ext.ux.touch.grid.feature.Sorter'
]);
Ext.setup({
onReady: function() {
Ext.define('TestModel', {
extend : 'Ext.data.Model',
config : {
fields : [
'company',
'price',
'change',
'pct',
'updated'
]
}
});
var store = Ext.create('Ext.data.Store', {
model : 'TestModel',
data : [
{ company : '3m Co', price : 71.72, change : 0.02, pct : 0.03, updated : '9/1/2010' },
//...
{ company : 'Wal-Mart Stores, Inc.', price : 45.45, change : 0.73, pct : 1.63, updated : '9/1/2010' }
]
});
Ext.create('Ext.TabPanel', {
fullscreen: true,
tabBarPosition: 'bottom',
defaults: {
styleHtmlContent: true
},
items: [
{
title: 'Reports',
iconCls: 'home',
xtype: 'tabpanel',
items: [
{
title: 'Report A',
// uncomment to get an issue
// xtype: 'container',
// items: [
// {
// xtype: 'selectfield',
// store: store,
// displayField: 'company',
// valueField: 'company'
//
//
// },
// {
xtype: 'touchgridpanel',
store : store,
features : [
{
ftype : 'Ext.ux.touch.grid.feature.Sorter',
launchFn : 'initialize'
}
],
columns : [
{
header : 'Company',
dataIndex : 'company',
style : 'padding-left: 1em;',
width : '40%',
filter : { type : 'string' }
},
{
header : 'Price',
dataIndex : 'price',
style : 'text-align: center;',
width : '15%',
filter : { type : 'numeric' }
},
{
header : 'Change',
dataIndex : 'change',
cls : 'centered-cell redgreen-cell',
width : '15%',
renderer : function (value) {
var cls = (value > 0) ? 'green' : 'red';
return '<span class="' + cls + '">' + value + '</span>';
}
},
{
header : '% Change',
dataIndex : 'pct',
cls : 'centered-cell redgreen-cell',
width : '15%',
renderer : function (value) {
var cls = (value > 0) ? 'green' : 'red';
return '<span class="' + cls + '">' + value + '</span>';
}
},
{
header : 'Last Updated',
dataIndex : 'updated',
hidden : true,
style : 'text-align: right; padding-right: 1em;',
sortable : false,
width : '15%'
}
]
// }] // uncomment to get an issue
},
{
title: 'Report B',
html: 'Text 2'
},
{
title: 'Report C',
html: 'Text 3'
}],
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen'
}
]
});
}
});