ext4.2 MVC中在girdpanel展示用户简单列表信息,怎么实现点击详情按钮,到formpanel中的数据怎么传递展示
我现在是setvalue方式,但是图片路径的不知道怎么写上去,setvalue的方式麻烦,大神们有好的方法不
icon : './resources/images/bogus.png',
tooltip : '查看详情', handler : function(grid, rowIndex, colIndex) { var record = grid.getStore().getAt(rowIndex); var data = record.data; console.log(data); if(data.validate == "个人发布方"){ var win = Ext.getCmp('mu-infoDetailForm_person_win'); if (!win) { win = Ext.create('Ext.window.Window', { title : '用户详情', id : "mu-infoDetailForm_person_win", iconCls: 'detail', resizable:false, width : "50%", height : "60%", autoScroll: true, modal : true, items : [ { xtype:"mu-infoDetailForm1" }] }); var form = Ext.getCmp("mu-infoDetailForm1").getForm(); form.findField("name").setValue(data.fbPersonal.name); form.findField("validate").setValue(data.validate); form.findField("tel").setValue(data.tel); form.findField("idCard").setValue(data.fbPersonal.idCard); form.findField("province").setValue(data.fbPersonal.province); form.findField("city").setValue(data.fbPersonal.city); form.findField("county").setValue(data.fbPersonal.county); form.findField("auditState").setValue(data.auditState); win.show(); }else{ win.show(); } }
ext是前端的MVC框架,其中ext4的分层还是很清晰的。看你的写法是在view层处理事件,而且是直接通过id属性获取控件。相对来说更推荐itemId的方式去处理,建议事件放在controller中处理。
根据你的需求可以这样处理:
1、在controller中定义页面详情按钮的监听事件,指定该事件的处理方法; 2、通过queryGrid = this.getControlledView(),selModel = queryGrid.getSelectionModel()即可获取选中的数据(此处应该判断是否多条数据) 3、可以通过queryGrid.billForm.form.load()方法赋值(billForm需在gridpanel中指定)
这个框架好大 坡度有些堵 应用场景有限 可以试试easyui