- var store = new Ext.data.JsonStore({
- idProperty : 'id',
- fields : ['id', 'title', 'samples'],
- data : catalog
- });
-
- var panel = new Ext.Panel({
- frame : true,
- renderTo : 'all-demos',
- height : 300,
- autoScroll : true,
- items : new SamplePanel({
- store : store
- })
- });
-
- var tpl = new Ext.XTemplate(
- '<tpl for="."><li><a href="#{id}">{title:stripTags}</a></li></tpl>'
- );
- tpl.overwrite('sample-menu', catalog);
-
- Ext.select('#sample-spacer').remove();
-
- var headerEl = Ext.get('hd'),
- footerEl = Ext.get('ft'),
- bodyEl = Ext.get('bd'),
- sideBoxEl = bodyEl.child('div[class=side-box]'),
- titleEl = bodyEl.child('h3:first-child');
-
- var doResize = function() {
- var windowHeight = Ext.getDoc().getViewSize(false).height;
-
- var footerHeight = footerEl.getHeight() + footerEl.getMargins().top,
- titleElHeight = titleEl.getHeight() + titleEl.getMargins().top,
- brElHeight = bodyEl.child('br').getHeight(),
- headerHeight = headerEl.getHeight() + titleElHeight + brElHeight;
-
- var warnEl = Ext.get('fb');
- var warnHeight = warnEl ? warnEl.getHeight() : 0;
-
- var availHeight = windowHeight - ( footerHeight + headerHeight + 14) - warnHeight;
- var sideBoxHeight = sideBoxEl.getHeight();
-
- panel.setHeight((availHeight > sideBoxHeight) ? availHeight : sideBoxHeight);
- }