[K/3Cloud] 如何从被调用的动态表单界面返回数据

在需要返回数据的地方调用表单返回方法完成数据返回

this.View.ReturnToParentWindow(retData);

在调用界面的回调函数中取出返回结果的ReturnData即可使用。


例如:

在动态表单的按钮事件中调用此方法

 //确定按钮事件
        private void SaveClaimerAndDate()
        {
            string errMsg = Check();
            if (!string.IsNullOrWhiteSpace(errMsg))
            {
                this.View.ShowErrMessage(errMsg);
            }
            else
            {
                this.View.ReturnToParentWindow(SetDateAndClaimer());
                this.View.Close();
            }
        }

在调用界面的回调函数中取数:

private void GetSale()
        {
            ListShowParameter listpara = new ListShowParameter();
            listpara.FormId = Topview.FT.Common.Core.FTConst.SALECONTRACT_FORMID;//外销合同
            listpara.ParentPageId = this.View.PageId;
            listpara.MultiSelect = false;
            listpara.IsShowApproved = true;
            listpara.OpenStyle.CacheId = listpara.PageId;
            listpara.IsLookUp = true;   //F7
            this.View.ShowForm(listpara, new Action<FormResult>((result) =>
            {
                object data = result.ReturnData;
                if (data is ListSelectedRowCollection)
                {
                    ListSelectedRowCollection listData = data as ListSelectedRowCollection;
                    if (listData != null && listData.Count > 0)
                    {
                        DynamicObject dy = CommonCoreUtils.GetDateFromFID(this.Context, Topview.FT.Common.Core.FTConst.RECEIVEREGISTRATION, "FID", listData[0].PrimaryKeyValue, "FBILLNO");
                        this.Model.SetValue("FSaleContractId", dy["FBILLNO"]);
                    }
                }
            }
            ));
        }


原文地址:https://www.cnblogs.com/fyq891014/p/4188829.html