账表.二开方案.过滤界面动态增加显示隐藏列

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

账表.二开方案.过滤界面动态增加显示隐藏列

【场景】过滤界面动态增加显示隐藏列 【案例】表单插件 ```sharp using Kingdee.BOS.Core.CommonFilter; using Kingdee.BOS.Core.CommonFilter.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Util; using System.Collections.Generic; using System.Linq; namespace DynamicFormPlugIn.Filter { [Kingdee.BOS.Util.HotUpdate] public class RptFliterPlugIn : AbstractCommonFilterPlugIn { public override void DataChanged(DataChangedEventArgs e) { base.DataChanged(e); if(e.Field.Key == "F_BHR_CheckBox") { SetFieldVisible(ObjectUtils.Object2Bool(e.NewValue)); } } private void SetFieldVisible(bool showField) { List<string> specFieldList = new List<string>() { "aaa", "bbb" }; ICommonFilterModelService filterModel = this.Model as ICommonFilterModelService; if (filterModel == null) return; var fieldList = filterModel.ColumnObject.AllFieldList; if (showField) { foreach(var specKey in specFieldList) { var field = fieldList.FirstOrDefault(x => x.Key == specKey); if (field == null) { field = new ColumnField(new Kingdee.BOS.LocaleValue(specKey), specKey, fieldList.Count + 1, 50, 50, true, true); field.FieldName = specKey; field.EntityKey = "FBillHead"; fieldList.Add(field); } } } else { foreach (var specKey in specFieldList) { var field = fieldList.FirstOrDefault(x => x.Key == specKey); if (field != null) { fieldList.Remove(field); } } } filterModel.ColumnObject.SetFieldList(fieldList); // 显示隐藏列 FieldShowHide showhide = this.View.GetControl(CommonFilterConst.ControlKey_FieldShowHide) as FieldShowHide; if (showhide != null) { showhide.SetShowHideFields(((ICommonFilterModelService)this.Model).ColumnObject.GetAllFieldList(true)); } } } } ``` 【效果】点击复选框后显示aaa和bbb,支持服务插件获取 ![Image_20230322174238.webp](/download/0100fa2b1aaa36294d3582f598329dcaa04a.webp)

emj


账表.二开方案.过滤界面动态增加显示隐藏列

【场景】过滤界面动态增加显示隐藏列【案例】表单插件```sharpusing Kingdee.BOS.Core.CommonFilter;using Kingdee.BOS.Core.CommonFilte...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息