起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2123|回复: 6

[结贴] 父页面打开子页面时的数据刷新问题

[复制链接]

34

主题

147

帖子

368

积分

中级会员

Rank: 3Rank: 3

积分
368
QQ
发表于 2019-3-16 16:16:42 | 显示全部楼层 |阅读模式
父页面A,子页面B
------------------------------------------
父页面A打开子页面的方法为:
var dialog = this.comp('wdRoleToAuthority');
                       
                        var roleID = row.val("RoleID");
                        var description = row.val("Description");
                        var roleCode = row.val("RoleCode");
                       
                    var url = require.toUrl('$UI/portal/dzbzxt/SystemManage/Role/roleToAuthority.w?RoleID='+roleID+'&Description='+description+'&RoleCode='+roleCode);
                    dialog.open({
                        src: url,
                        params: {
                            a1: roleID,//row.val("RoleID"),
                            a2: description,//row.val("Description"),
                            a3: roleCode,//row.val("RoleCode"),
                            data:{
                                        RoleID : roleID,//row.val("RoleID"),
                                        Description: description,//row.val("Description"),
                                                RoleCode: roleCode//row.val("RoleCode")
                            }
                        }
                        
                    })

---------------------------------------
在子页面B中获取参数:
Model.prototype.modelLoad = function(event){
                var context = this.getContext();
                this.currentRoleCode = context.getRequestParameter('RoleCode');
                this.currentDescription = context.getRequestParameter('Description');
                this.currentRoleID = context.getRequestParameter('RoleID');
                alert("modelLoad>>>context.getRequestParameter('RoleID')>>>" + context.getRequestParameter('RoleID'));
                alert("modelLoad>>>this.currentRoleID>>>" + this.currentRoleID);
        };

子页面B 接收到参数后,在resoureDataCustomRefresh这里获取不到参数

发现 resoureDataCustomRefresh 是在 modelLoad事件前调用的。

resoureDataCustomRefresh代码如下:

Model.prototype.resoureDataCustomRefresh = function(event){
                debugger;
                var context = this.getContext();
                this.currentRoleCode = context.getRequestParameter('RoleCode');
                this.currentDescription = context.getRequestParameter('Description');
                this.currentRoleID = context.getRequestParameter('RoleID');
               
                alert("resoureDataCustomRefresh>>>this.currentRoleID>>>" + this.currentRoleID);
                var me = this;
                var resourceData = event.source;
                resourceData.clear();
               
                // 构造请求参数
                var params = {
                        "CurrentRoleID" : me.currentRoleID,// 当前角色ID
                        "AllRole" : 99 // 是否所有的模块
                };
               
                DB.sendRequest({
                        "url" : "/SystemManagementWeb", // servlet请求地址
                        "action" : "QueryRoleTreeGridDataAction", //action
                        "params" : params, // action对应的参数
                        "async": false,
                        "success" : function(data){
                                resourceData.loadData(data);
                        }
                // 请求成功后的回调方法
                });
               
                resourceData.applyUpdates();
        };

34

主题

147

帖子

368

积分

中级会员

Rank: 3Rank: 3

积分
368
QQ
 楼主| 发表于 2019-3-16 16:17:24 | 显示全部楼层
resoureDataCustomRefresh 竟然在 modelLoad事件前调用的
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35880
发表于 2019-3-18 17:28:02 | 显示全部楼层
data的autoLoad设置为false,在onLoad中调用data的刷新
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

34

主题

147

帖子

368

积分

中级会员

Rank: 3Rank: 3

积分
368
QQ
 楼主| 发表于 2019-3-18 20:10:48 | 显示全部楼层
结贴吧,谢谢
回复 支持 反对

使用道具 举报

34

主题

147

帖子

368

积分

中级会员

Rank: 3Rank: 3

积分
368
QQ
 楼主| 发表于 2019-3-19 09:50:20 | 显示全部楼层
子页面的modelParamsReceive这个方法应该是最先执行的,这里是得到父页面传递来的参数,子页面拿到参数后,再去执行resoureDataCustomRefresh刷新数据。
回复 支持 反对

使用道具 举报

34

主题

147

帖子

368

积分

中级会员

Rank: 3Rank: 3

积分
368
QQ
 楼主| 发表于 2019-3-19 09:55:36 | 显示全部楼层
本帖最后由 silverlong 于 2019-3-19 10:06 编辑

justep.Shell.showPage打开子页面的,如下代码var roleID = row.val("RoleID");
                        var description = row.val("Description");
                        var roleCode = row.val("RoleCode");

var urlParams = "?RoleID="+roleID+"&Description="+description+"&RoleCode="+roleCode;
                    var url ="$UI/portal/dzbzxt/SystemManage/Role/roleToAuthority.w?" + urlParams;
                    
                    
                        
                    var params = {
                            roleID: roleID,
                    description: description,
                    roleCode: roleCode,
                    data:{
                                        RoleID : roleID,
                                        Description: description,
                                                RoleCode: roleCode
                            }
                };
-------------------
在子页面代码如下:
Model.prototype.modelLoad = function(event){
                var context = this.getContext();
                this.currentRoleCode = context.getRequestParameter('RoleCode');
                this.currentDescription = context.getRequestParameter('Description');
                this.currentRoleID = context.getRequestParameter('RoleID');
                alert("modelLoad>>>context.getRequestParameter('RoleID')>>>" + context.getRequestParameter('RoleID'));
                alert("modelLoad>>>this.currentRoleID>>>" + this.currentRoleID);
        };
----------------------
得不到参数啊。
回复 支持 反对

使用道具 举报

34

主题

147

帖子

368

积分

中级会员

Rank: 3Rank: 3

积分
368
QQ
 楼主| 发表于 2019-3-19 10:02:26 | 显示全部楼层
哎,为了赶项目,只能这样
父页面:localStorage.setItem('CurrentRoleID', roleID);
子页面:this.currentRoleID = localStorage.getItem("CurrentRoleID");
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-3-29 19:22 , Processed in 0.075455 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表