移动列表行格式示例代码原创
5人赞赏了该文章
2504次浏览
编辑于2020年10月09日 14:29:10
行格式化可以设置指定行、指定控件的属性(如:字体颜色、背景色、背景图片、可见性、高、宽等),具体支持哪些属性的设置,请查看MobileFormatCondition类。
1、移动单据列表行格式
[Description("销售业务圈改变单据状态颜色插件")] public class TestSaleBusiness:AbstractMobileListPlugin { public override void OnFormatRowConditions(Core.List.PlugIn.Args.ListFormatConditionArgs args) { base.OnFormatRowConditions(args); DynamicObject obj = ((DynamicObjectDataRow)args.DataRow).DynamicObject; if (obj["FDOCUMENTSTATUS"].ToString() == "C") { //设置单据状态颜色,以及布局背景图片 args.FormatConditions.Add(new MobileFormatCondition() { Key = "FMobileBillStatus", ForeColor = "255,255,0,0" }); args.FormatConditions.Add(new MobileFormatCondition() { Key = "FFlowLayout111", ImageKey = "YesBtn.png" }); } else { //设置单据状态颜色,以及布局背景图片 args.FormatConditions.Add(new MobileFormatCondition() { Key = "FMobileBillStatus", ForeColor = "255,32,167,0" }); args.FormatConditions.Add(new MobileFormatCondition() { Key = "FFlowLayout111", ImageKey = "NoBtn.png" }); } } }
2、移动单据体(移动列表)行格式化
[System.ComponentModel.Description("查看影像操作列表-表单插件")] public class ASCImageOperationEdit : AbstractMobilePlugin { public override void AfterBindData(EventArgs e) { base.AfterBindData(e); var ascImageDict = this.View.ParentFormView.Session["ASCImageDict"] as Dictionary; if (!ascImageDict.IsEmpty()) { List formatCondition = new List(); for (int i = 0; i < ascImageDict.Count; i++) { int rowIndex = this.Model.GetEntryRowCount("FMobileListViewEntity"); this.Model.CreateNewEntryRow("FMobileListViewEntity"); formatCondition.Add(new MobileFormatCondition() {Key = "FViewImage",Value = ascImageDict.Values.ElementAt(i).Get("Name").ToString(),Row = rowIndex + 1 }); if (i % 2 == 0) { formatCondition.Add(new MobileFormatCondition() { Key = "FStatus", ForeColor = "255,81,186,255", Row = rowIndex + 1 }); } else { formatCondition.Add(new MobileFormatCondition() { Key = "FStatus", ForeColor = "255,32,167,0", Row = i + 1 }); } } this.View.GetControl<MobileListViewControl>("FMobileListViewEntity").setFormat(formatCondition ); this.View.UpdateView("FMobileListViewEntity"); } } }
注:MobileFormatCondition的Editable属性可以设置字段是否可编辑,Visible、Disabled设置控件的可见性和锁定性。
推荐阅读