账表.二开方案.过滤界面动态增加显示隐藏列
【场景】过滤界面动态增加显示隐藏列
【案例】表单插件
```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...
点击下载文档
上一篇:bos单选按钮组的使用下一篇:BOS运行时-业务数日志-归档和清理
本文2024-09-16 18:32:00发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-22761.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章