Extjs MVC模式下传递参数 动态插入Item
来源:互联网 发布:阿里云代金券转让 编辑:程序博客网 时间:2024/06/07 13:13
项目中遇到一个参数传递的问题,一直没有办法解决,最近终于解决了,现分享给大家
view层:
Ext.define('app.view.Empma', { extend: 'Ext.panel.Panel', alias: 'widget.xEmpma', title: '测试', iconCls: 'icon-empma', forceFit: true, id:'empma', tbar: [{ iconCls: 'icon-folderinput', text: '获取信息', action: 'getMssages' }], items:[//item动态插入 ], store: 'Empma' });controller层:
Ext.define('app.controller.Empma', { extend: 'Ext.app.Controller', refs: [{ ref: 'Empma', selector: 'xEmpma' }], models: ['Empma'], stores: ['Empma'], init: function() { this.control({ 'xEmpma button': { accept: this.onEmpAccept }, //传递参数类型 'xEmpma button[action=rejected]': { click: this.onEmpRejected }, //不传递参数类型 'xEmpma button[action=getMssages]': { click: this.onEmpGetMssages } }); }, onEmpGetMssages:function(){ fc = Ext.getCmp('empma'); fc.removeAll(); //移除fc中的内容,为添加item做准备 Ext.Ajax.request({ url:'./data/empma.txt', success:function(response,options){ var tStrr = response.responseText; var tStrrjson=eval("("+tStrr+")"); var tStrrjsonErcode = tStrrjson["AuthId"]; var DestPlatforms = tStrrjson["DestPlatform"]; var SrcPlatform = tStrrjson["SrcPlatform"]; for(var i=0;i < DestPlatforms.length;i++){ var items = { xtype :'form', frame : false, border : 0, method : 'POST', layout : 'column', items : [{ id :'address_to'+i, name :'address_to'+i, xtype: 'component', margin : 15, columnWidth:.3, html: '源ID:'+SrcPlatform.Id },{ id :'address_from'+i, name :'address_from'+i, xtype: 'component', margin : 15, columnWidth:.3, html: '目的ID:'+DestPlatforms[0].Id },{ id :'address_interval'+i, name :'address_interval'+i, xtype: 'component', margin : 15, columnWidth:.24, html: '时长:'+DestPlatforms[0].TermValidity },{ id :'address_accept'+i, xtype: 'button', name:'address_accept'+i, text: ' 同 意 ', margin : 15, columnWidth:.08, //action:'accept', handler: function (test) { this.fireEvent('accept', test); } },{ id :'address_rejected'+i, xtype: 'button', name :"address_rejected"+i, text: ' 拒 绝 ', columnWidth:.08, margin : 15, action:'rejected' }] //生成item }; fc.add(items); fc.doLayout(); }; }, failure:function(){ alert("failure"); } }); }, onEmpAccept: function(test) { alert(test.id); } });案例中用到的json:
{ "AuthId": "666", "SrcPlatform": { "Id": "s", "name": "b" }, "totalCount":3, "DestPlatform": [ { "Id": "1", "Name": "d1", "TermValidity": "25" }, { "Id": "2", "Name": "d2", "TermValidity": "36" }, { "Id": "3", "Name": "d3", "TermValidity": "123" } ] }
以上就是在Extjs中使用MVC模式传递参数和不传递参数的写法。
如有疑惑,欢迎留言。
如有疑惑,欢迎留言。
感谢阅读,感谢订阅。
0 0
- Extjs MVC模式下传递参数 动态插入Item
- ExtJS在传统模式、MVC模式下的使用区别
- Extjs MVC开发模式
- extjs-mvc开发模式
- Extjs MVC开发模式
- flask框架的参数传递以及MVC模式的图解
- Extjs 多个参数传递
- Spring MVC 传递参数
- Spring MVC 参数传递
- spring MVC 参数传递
- spring MVC参数传递
- Spring mvc 参数传递
- EXT.NET MVC下按条件传递参数
- Extjs MVC开发模式详解
- ExtJS学习:MVC模式案例
- Extjs MVC开发模式详解
- Extjs MVC开发模式详解
- Extjs MVC开发模式详解
- 大小端系统
- spring mvc Restful架构
- LINK1123:failure during conversion to COFF:file invalid or corrupt
- InputService
- ubuntu 命令
- Extjs MVC模式下传递参数 动态插入Item
- Android textView drawableXX图片大小
- hadoop 端口
- Linux网络编程面试--滑动窗口的实现机制
- Disable Keyboard Shortcuts and Combination Keys with C# (3): Disable Ctrl + Alt + Del
- 在UiAutomator2.0测试脚本中操作联系人数据
- js 双引号中引入变量
- 我的求职之路(一)
- Linux 克隆虚拟机引起的“Device eth0 does not seem to be present, delaying initialization”