Code:
if ((typeof console) == "undefined" || (typeof console.log) == "undefined")
{
console = {
log: function (v) {} // do nothing if undefined
}
}
Ext.BLANK_IMAGE_URL = "ext/resources/images/default/s.gif";
Ext.namespace("SailCalc");
SailCalc.main = function()
{
return (
{
main_win: null,
gateway: "include/io.php",
init: function()
{
// check for loading mask
Ext.destroy(Ext.get("loading"));
Ext.destroy(Ext.get("loading-mask"));
var beginner_store = new Ext.data.ArrayStore({
autoDestroy: false,
fields: ['kts','mph','kph','sail']
});
var sailsize_store = new Ext.data.ArrayStore({
autoDestroy: false,
fields: ['kts','mph','kph','sail']
});
this.main_win = new Ext.Panel({
renderTo: 'sailcalc',
width: 600,
height: 400,
title: 'Sail Size Calculator',
layout: 'fit',
tbar: new Ext.Toolbar({
id: 'sailcalc-tbar',
items: [
'Sailor weight:',
{
xtype: 'textfield',
width: 30,
id: 'sailcalc-weight'
},
'pounds',
'-',
{
text: 'Update',
id: 'sailcalc-update',
scope: this,
handler: function()
{
console.log('click');
}
}
]
}),
items: [
{
xtype: 'tabpanel',
border: false,
activeItem: 0,
items: [
{
title: 'Grids',
items: [
{
border: false,
layout: 'column',
items: [
{
columnWidth: .33,
height: 320,
xtype: 'grid',
title: 'Sail Size by Wind Speed',
id: 'sailsize-grid',
store: sailsize_store,
columns: [
{header: 'Kts', dataIndex: 'kts', sortable: false, width: 40, menuDisabled: true},
{header: 'Mph', dataIndex: 'mph', sortable: false, width: 40, menuDisabled: true},
{header: 'Kph', dataIndex: 'kph', sortable: false, width: 40, menuDisabled: true},
{header: 'Sail Size (m<sup>2</sup>)', dataIndex: 'sail', sortable: false, width: 74, menuDisabled: true}
]
},
{
columnWidth: .33,
height: 320,
xtype: 'grid',
title: 'Wind Speed by Sail Size',
id: 'windspeed-grid',
store: sailsize_store,
columns: [
{header: 'Sail Size (m<sup>2</sup>)', dataIndex: 'sail', sortable: false, width: 74, menuDisabled: true},
{header: 'Kts', dataIndex: 'kts', sortable: false, width: 40, menuDisabled: true},
{header: 'Mph', dataIndex: 'mph', sortable: false, width: 40, menuDisabled: true},
{header: 'Kph', dataIndex: 'kph', sortable: false, width: 40, menuDisabled: true}
]
},
{
columnWidth: .34,
height: 320,
xtype: 'grid',
title: 'Beginner Sail Size',
id: 'beginner-grid',
store: beginner_store,
columns: [
{header: 'Kts', dataIndex: 'kts', sortable: false, width: 40, menuDisabled: true},
{header: 'Mph', dataIndex: 'mph', sortable: false, width: 40, menuDisabled: true},
{header: 'Kph', dataIndex: 'kph', sortable: false, width: 40, menuDisabled: true},
{header: 'Sail Size (m<sup>2</sup>)', dataIndex: 'sail', sortable: false, width: 74, menuDisabled: true}
]
}
]
}
]
},
{
title: 'Chart'
}
]
}
],
listeners: {
'render': function(p)
{
var nav = new Ext.KeyNav('sailcalc-tbar', {'enter': Ext.getCmp('sailcalc-update').handler, scope: this});
},
scope: this
}
});
}
});
}();