javascript - How do I create a footer in Sencha that will be docked unless the content overflows the page? -
i'm creating native app using phonegap , sencha (not choice). have pages little content want footer on bottom of. so, dock footer bottom. however, on other pages content overflows viewport not want footer awkwardly docked on top of content has run past it. in case, content overflows viewport, want footer in flow of page, scrolable page. fixing easy moving footer page flow. so, in theory configure footer either docked or in page flow every page. but, thats unreasonable , unrealistic pages in app dynamically produce content db creating pages 1 item , others hundreds.
so, how can create functionality looks @ page, assesing content on page in comparison viewport , automatically sets footer either docked bottom on tiny pages, or in page flow on longer pages?
ok of depends on components using , layout affecting them.. after few mins of messing around came this.
ext.define('myapp.view.main', { extend: 'ext.container', xtype: 'main', requires: [ 'ext.titlebar' ], config: { items: [{ docked: 'top', xtype: 'titlebar', title: 'titebar' }, { xtype: 'container', // represents page // height of container set 100% // height: '100%', scrollable: true, items: [{ // long content // html: "lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", // shorter content html: "lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", // min height of container 100% of viewport height (vh) // subtract height of footer. // style: 'min-height: calc(100vh - 95px);' }, { // if toolbar same across multiple pages // can create new class of toolbar , // reference xtype: 'myreusablefooter' // xtype: 'toolbar', items: [{ text: 'footer items...' }] }] }] } }); you can play here.
https://fiddle.sencha.com/fiddle/14uo/preview
and can see code here
Comments
Post a Comment