一些特殊控件取赋值原创
9人赞赏了该文章
2,536次浏览
编辑于2022年03月05日 12:28:31
1.列表控件赋值:
var lstCtl = View.GetControl<ComboFieldEditor>("列表控件Key"); var lstItem = new List<EnumItem>();//枚举项集合 for(int i=0;i<10;i++) { var enumItem = new EnumItem() { EnumId = i, Value = "value"+i.ToString(), Caption = new LocaleValue("text"+i.ToString()) }; lstItem.Add(enumItem); } lstCtl.SetComboItems(lstItem); //设置下拉列表框 lstCtl.SetValue("value5"); //设置当前显示值
2.列表控件取值:
var comboField = this.View.BillBusinessInfo.GetField("列表控件Key"") as ComboField; var enumObjs = comboField.EnumObject; //所有枚举值
3. 树形控件:
var treeView = this.View.GetControl<TreeView>("树形控件Key"); var rootNode = new TreeNode() { id="AllNode", text="全部"};//跟节点 for(int i=0;i<10;i++) { var node = new TreeNode() { xtype = "leaf", id = "id"+i.ToString(), text = "text"+i.ToString() }; rootNode.children.Add(node); } treeView.ClearAllNode(); treeView.SetRootNode(rootNode); //把根节点赋值给树形控件 treeView.SetExpanded(true);
4.单据类型字段取值:
BillTypeField typeField = this.View.BillBusinessInfo.GetFieldList().FirstOrDefault(x=>x is BillTypeField) as BillTypeField; if(typeField != null) { var billTypes = field.BillTypeInfo; //所有单据类型}
5. 基础资料字段
web层: this.Model.SetValue("基础资料key",内码)或 this.Model.SetValue("基础资料key",基础资料数据包); App层: BaseDataField baseField = this.BusinessInfo.GetField("Fkey") as BaseDataField; baseField.RefIDDynamicProperty.SetValue("单据数据包",内码); baseField.DynamicProperty.SetValue("单据数据包","基础资料数据包"); 取基础资料数据包: var queryParam = new QueryBuilderParemeter(); queryParam.FormId = baseField.LookUpObject .FormId; queryParam1.FilterClauseWihtKey = strfilter ; var baseDatas= BusinessDataServiceHelper.LoadFromCache(this.Context, baseField.RefFormDynamicObjectType, queryParam);
6.多选基础资料
web层: this.Model.SerValue(key,内码,行号) app层: var mulBaseField = this.BusinessInfo.GetField("key") as MulBaseDataField; var mulBaseFieldObjs = mulBaseField .RefEntityDynamicProperty.GetValue(activeRow) as DynamicObjectCollection; for(int i=0;i<10;i++) { var dynObj= new DynamicObject(mulBaseField .RefEntityDynamicObjectType); mulBaseField .RefIDDynamicProperty.SetValue(dynObj, 内码); mulBaseField .DynamicProperty.SetValue(dynObj, 数据包); //如果没有数据包,可以先得到一个空的数据包,给空数据包赋值 var baseObj = mulBaseField.DynamicProperty.GetValue(dynObj); baseObj[Number]="001"; mulBaseFieldObjs.Add(dynObj);
}
7.元数据
app: MetadataXmlReader reader = new MetadataXmlReader(context); FormMetadata metadata = (FormMetadata)reader.Load(formId); var bInfo = fMetaData.BusinessInfo; web: FormMetadata metadata = FormMetaDataCache.GetCachedFormMetaData(context, formId); var bInfo = metadata.BusinessInfo;
赞 9
9人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!