sencha touch - Showing a carousel from a nestedList - possibly using handler? -
i have nestedlist - when final item, call handler swaps panel carousel. please see - http://test.miaduk.com/mobile/tle/
unfortunately can't seem handlers work on nested items , can not think of way. i'm still beginner in sencha, appreciated. thank you!
see code:
ext.setup({ icon: 'icon.png', tabletstartupscreen: 'tablet_startup.png', phonestartupscreen: 'phone_startup.png', glossonicon: true, onready: function() { /*data store *********************************************************************************/ var data = { text: 'categories', items: [{ text: 'core skills/personal development', items: [{ text: 'fishbone diagram', leaf: true },{ text: '5 whys technique', leaf: true },{ text: 'smart objectives', leaf: true },{ text: 'circle of influence', leaf: true },{ text: 'managing stress', leaf: true }] },{ text: 'communication', items: [{ text: 'listening skills', leaf: true },{ text: 'giving feedback', leaf: true },{ text: 'recieving feedback', leaf: true }] },{ text: 'customer service', items: [{ text: 'listening , confirming', leaf: true }] }] }; ext.regmodel('listitem', { fields: [{name: 'text', type: 'string'}] }); var store = new ext.data.treestore({ model: 'listitem', root: data, proxy: { type: 'ajax', reader: { type: 'tree', root: 'items' } } }); var nestedlist = new ext.nestedlist({ fullscreen: true, title: 'categories', displayfield: 'text', dock: 'top', store: store }); /*carousel *********************************************************************************/ var carousel = new ext.carousel({ fullscreen: true, displayfield: 'text', dock: 'top', defaults: { cls: 'card' }, items: [{ html: '<img src="drainimage1.png">' }, { title: 'tab 2', html: '<img src="drainimage2.png">' }] }); /*tab panel *********************************************************************************/ var tabpanel = new ext.tabpanel({ tabbar: { dock: 'bottom', layout: { pack: 'center' } }, fullscreen: true, ui: 'light', cardswitchanimation: { type: 'slide', cover: true }, defaults: { scroll: 'vertical' }, items: [{ title: 'my courses', html: '<h1>course list appear here</h1>', iconcls: 'favorites', cls: 'card2', badgetext: '3', dockeditems: nestedlist },{ title: 'sample', cls: 'card2', iconcls: 'user', dockeditems: carousel },{ title: 'help', html: '<h1>help</h1><p>info on how add home screen goes here</p>', cls: 'card3', iconcls: 'user' }] });
check sample sencha nestedlist
http://dev.sencha.com/deploy/touch/examples/nestedlist/index.js
there "leafitemtap" event can hook nested list execute callback:
nestedlist.on('leafitemtap', function(sublist, subidx, el, e, detailcard) { var ds = sublist.getstore(), r = ds.getat(subidx); ext.ajax.request({ url: '../../src/' + r.get('id'), success: function(response) { detailcard.setvalue(response.responsetext); }, failure: function() { detailcard.setvalue("loading failed."); } }); });
Comments
Post a Comment