阅读:2363 回复:2
H3BPM
655

帖子

2504

跟帖

46406

积分

管理员
管理员
  • 社区居民

【实例分享】玩转数据字典新技能-字典库排序

楼主#
更多 发布于:2017-03-28 09:59
 数据字典使用场景:请假流程里的请假类型,有病假、事假、调休等。
定义数据字典,并且在流程中使用SheetDropDownListSheetRadioButtonList展现由用户来选择,如图:
 
   

图片:1.jpg


     数据字典

使用SheetDropDownList,并且设置该控件的属性MasterDataCategory为“请假类型”,其代码可能如下:
 
<SheetControls:SheetDropDownListID="SheetDropDownList1"runat="server"DataField="请假类型"MasterDataCategory="请假类型"></SheetControls:SheetDropDownList>
在表单中显示的效果如下:


   

图片:2.jpg




 表单设计器中使用
   

图片:3.png



 对于SheetDropDownListSheetCheckBoxList、SheetRadioButtonList控件,可以直接绑定数据字典显示选项。

数据字典固然方便,一不小心就建多了,字典库多了用起来也是有点麻烦。

图片:0.png



下面教给大家一个简单实用的排序技能.
首先找到
\Portal\Admin\MvcDesigner\MvcDesignerService.ashx

下面的这个函数

#region 获取数据字典
  
        public void GetMasterDataCategory(HttpContext context)
        {
            List<string> items = new List<string>();
            Dictionary<string, string> table = OThinker.H3.WorkSheet.AppUtility.Engine.MetadataRepository.GetCategoryTable();
            foreach (string key in table.OrderBy(s=>s.Value).Select(x=>x.Key))
            {
                items.Add(table[key]);
            }
            context.Response.Write(JSSerializer.Serialize(items));
        }
  
        #endregion

把原来的 table.Keys 改成
table.OrderBy(s=>s.Value).Select(x=>x.Key)

可以任意改成喜欢的排序都可以。

以上排序方案整理于问题互助板块@t156965365   表单绑定字典库问题,没有排序,字典库多了选择比较麻烦 的回答。

如有疑问可继续提问,或查看帮助手册

最新喜欢:

小小鱼儿灬水中游小小鱼儿灬水...
10月签到活动奖励发放啦:http://bbs.h3bpm.com/read.php?tid=5377&fid=5
越王勾践
167

帖子

1099

跟帖

19415

积分

论坛版主
论坛版主
  • 社区居民
  • 忠实会员
1楼#
发布于:2017-03-28 10:20
干货。
H3BPM
655

帖子

2504

跟帖

46406

积分

管理员
管理员
  • 社区居民
2楼#
发布于:2017-03-28 10:23
越王勾践:干货。回到原帖
越王也走一篇~~
10月签到活动奖励发放啦:http://bbs.h3bpm.com/read.php?tid=5377&fid=5
游客

返回顶部