sencha touch 简单实现手机点菜菜单
来源:互联网 发布:mac的搜狗输入法设置 编辑:程序博客网 时间:2024/05/29 04:58
Ext.define('app.controller.AddDishes', {Controller extend: 'Ext.app.Controller', config: { // models: [''], stores: ['AddDishes','AddDishesContent'],models: ['AddDishes','AddDishesContent'],views: ['order.AddDishes'],refs:{ mySelectedPanel:'button[action=mySelectedPanel]', searchShow:'button[action=searchShow]', addDishesTpl:'addDishesTpl', container:'container', addDishes:'addDishes',}, control: { searchShow:{ tap:function(){ if(!this.actions){ this.actions=Ext.Viewport.add({ xtype:'actionsheet', top:'-1px', style:"height:30px;background-color:#fff;", modal:true, hideOnMaskTap:true, hideAnimation:{ type:'fadeOut',duration: 250, easing: 'ease-out'}, items:[{ xtype:'toolbar',docked:'top',style:'background-color:#fff;',defaults:{ layout:'hbox',},items:[{ xtype:'searchfield',},{ xtype:'button', text:'完成',}] }]})}this.actions.show({type:'slide',direction: 'right'});}},//单击菜系名称addDishes:{ initialize:function(){ var store2=Ext.getStore('addDishesContent'); var store=Ext.getStore('addDishes'); store.clearFilter(); store2.clearFilter(); var length=store.data.length; var str = new Array(); var strId= new Array(); store.filterBy(function(record){ str.push(record.get('title')) strId.push(record.get('id')) }); for (i=0;i<strId.length;i++) { var button = Ext.create('Ext.Button', { text: str[i], baseCls:'title_btn', labelCls:'dishes_title', cls:'dishes_title', id:'cc'+strId[i], listeners:{ tap:function(t){ for(var j=0;j<strId.length;j++){ Ext.getCmp('cc'+strId[j]).setCls('dishes_title'); if('cc'+strId[j]==t.id){ Ext.getCmp(t.id).setCls('new_dishes_title'); } } var cc=store2.filter('titleId', t.id.replace(/[^0-9]/ig,"")); var list= Ext.create('Ext.List',{ store:cc, itemTpl: new Ext.XTemplate( '<div class="dishes_content">', '<div style="width:100%">{content}</div>', '<tpl if="status==1">', '<div ><span>原价: <span style="color:#6e6e6f;text-decoration:line-through">¥12.00份</span></span> <span>剩余:<span style="color:#7e7e7e">2</span></span></div>', '<div style="color:red;"><span style="background-color:red;color:#fff">特惠价</span> <span style="color:red">¥8.00/份(限3份)</span></div>', '</tpl>', '<tpl if="status==0">', '<div><span>价格: <span style="color:#7e7e7e">¥12.00份</span></span> <span>剩余:<span style="color:#7e7e7e">2</span></span></div>', '</tpl>', '</div>') }) list.setStore(store2); Ext.getCmp('addDishesContent').add(list); } } }) Ext.getCmp('addDishesTitle').add(button); } },show:function(){ var store=Ext.getStore('addDishes'); store.clearFilter(); var length=store.data.length; var str = new Array(); var strId= new Array(); store.filterBy(function(record){ str.push(record.get('title')) strId.push(record.get('id')) });var store2=Ext.getStore('addDishesContent'); store2.clearFilter();var cc=store2.filter('titleId', strId[0]); Ext.getCmp('cc'+strId[0]).setCls('new_dishes_title'); var list= Ext.create('Ext.List',{ store:cc, itemTpl: new Ext.XTemplate( '<div class="dishes_content">', '<div style="width:100%">{content}</div>', '<tpl if="status==1">', '<div ><span>原价: <span style="color:#6e6e6f;text-decoration:line-through">¥12.00份</span></span> <span>剩余:<span style="color:#7e7e7e">2</span></span></div>', '<div style="color:red;"><span style="background-color:red;color:#fff">特惠价</span> <span style="color:red">¥8.00/份(限3份)</span></div>', '</tpl>', '<tpl if="status==0">', '<div><span>价格: <span style="color:#7e7e7e">¥12.00份</span></span> <span>剩余:<span style="color:#7e7e7e">2</span></span></div>', '</tpl>', '</div>')}) list.setStore(store2); Ext.getCmp('addDishesContent').add(list); }}}}})View(视图)<pre name="code" class="javascript">Ext.define('app.view.AddDishes', { alternateClassName: 'addDishes', extend: 'Ext.Container', xtype: 'addDishes', requires: ['app.view.order.AddDishesTpl','app.view.order.AddDishesContentTpl'], config: { title: config.name+config.tableName,//cls:'bg',fullscreen: true, layout: 'hbox',items:[ { xtype: 'dataview' , id: 'addDishesTitle', cls:'label_dishes_left', flex:'1', layout:'vbox', items:[{ xtype:'button', docked:'top', baseCls:'search_btn', action:'searchShow', text:'搜索' }]},{ xtype:'list', id:'addDishesContent', cls:'label_dishes_right', flex:'3', listeners:{ itemtap:function(){ console.log('cc'); } }},{ hidden:true, xtype:'button', text:'确认加菜', docked:'bottom', baseCls:'dishes_look_btn', id:'confirmBtn', listeners:{ tap:function(){ util.showMessage('你还未添加菜品',true); } }},{ xtype:'button', text:'查看已选', docked:'bottom', baseCls:'dishes_look_btn', id:'seeBtn', listeners:{ tap:function(){ Ext.getCmp('panel').show({type: 'slide', direction: 'down'}); Ext.getCmp('mySelectedBtn').show({type: 'slide', direction: 'down'}); Ext.getCmp('priceBtnDown').setHidden(true); Ext.getCmp('priceBtnUp').setHidden(false); Ext.getCmp('confirmBtn').setHidden(false); Ext.getCmp('seeBtn').setHidden(true); } }},{ xtype:'button', text:'总价:'+12+'元', docked:'bottom', labelCls:'my_selected_lbtn', baseCls:'price_btn_down', id:'priceBtnDown', listeners:{ tap: function(){ Ext.getCmp('priceBtnDown').setHidden(true); Ext.getCmp('priceBtnUp').setHidden(false); Ext.getCmp('confirmBtn').setHidden(false); Ext.getCmp('seeBtn').setHidden(true); Ext.getCmp('panel').show({type: 'slide', direction: 'down'}); Ext.getCmp('mySelectedBtn').show({type: 'slide', direction: 'down'}); } }},{ hidden:true, xtype:'button', text:'总价:'+12+'元', docked:'bottom', baseCls:'price_btn_up', id:'priceBtnUp', labelCls:'my_selected_lbtn', listeners:{ tap: function(){ Ext.getCmp('priceBtnDown').setHidden(false); Ext.getCmp('priceBtnUp').setHidden(true); Ext.getCmp('confirmBtn').setHidden(true); Ext.getCmp('seeBtn').setHidden(false); Ext.getCmp('panel').setHidden(true); Ext.getCmp('mySelectedBtn').setHidden(true); } }},{ hidden:true, xtype:'list', docked:'bottom', style:'width:100%;height:280px;background-color:rgba(255,255,255,0);border-top:1px solid #ccc', id:'panel', },{ hidden:true, xtype:'button', text:'我的已选('+23+')', docked:'bottom', id:'mySelectedBtn', labelCls:'my_selected_lbtn', baseCls:'my_selected_btn', listeners:{ tap:function(){ Ext.getCmp('panel').setHidden(true); Ext.getCmp('mySelectedBtn').setHidden(true); Ext.getCmp('confirmBtn').setHidden(true); Ext.getCmp('seeBtn').setHidden(false); Ext.getCmp('priceBtnDown').setHidden(false); Ext.getCmp('priceBtnUp').setHidden(true); } } //id:'',}], }});
0 0
- sencha touch 简单实现手机点菜菜单
- sencha touch 实现android手机键盘对actionsheet的操作
- sencha touch实现分页
- sencha touch笔记(10)——简单实现slide navigation
- 手机上的HTML5框架 Sencha Touch
- sencha touch组件的简单实用
- Sencha Touch高性能list最简单高效的实现方案
- sencha touch 高性能 list最简单高效的实现方案
- Sencha Touch
- sencha touch
- sencha touch
- Sencha Touch 2 实现跨域访问
- Sencha Touch 2 实现跨域访问
- sencha touch《实现ajax跨域请求》
- sencha touch 实现安卓toast效果
- sencha touch 实现安卓toast效果
- sencha touch 搜索功能search的实现
- Sencha Touch 2 实现跨域访问
- C++编程对缓冲区的理解
- VMware的配置及ubuntu10.04 tftp 与嵌入式开发板的连接设置
- opennebula虚拟机启动失败
- [hdoj]2009
- 黑马程序员:java网络编程总结
- sencha touch 简单实现手机点菜菜单
- ARM工作模式以及程序的调用过程
- python使用paramiko
- Opennebula添加本地镜像问题
- 阶乘
- 最值得阅读学习的 10 个 C 语言开源项目代码
- 求子数组的最大和
- vsftpd配置实战
- uva 11636 贪心法