本文整理汇总了C#中Row.GetClientFieldValueList方法的典型用法代码示例。如果您正苦于以下问题:C# Row.GetClientFieldValueList方法的具体用法?C# Row.GetClientFieldValueList怎么用?C# Row.GetClientFieldValueList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.GetClientFieldValueList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FieldDefToJSON
protected virtual JSONDataMap FieldDefToJSON(Row row,
string schema,
Schema.FieldDef fdef,
string target,
string isoLang,
ModelFieldValueListLookupFunc valueListLookup)
{
var result = new JSONDataMap();
result["Name"] = fdef.Name;
result["Type"] = MapCLRTypeToJS(fdef.NonNullableType);
var key = fdef.AnyTargetKey;
if (key) result["Key"] = key;
if (fdef.NonNullableType.IsEnum)
{ //Generate default lookupdict for enum
var names = Enum.GetNames(fdef.NonNullableType);
var values = new JSONDataMap(true);
foreach(var name in names)
values[name] = name;
result["LookupDict"] = values;
}
var attr = fdef[target];
if (attr!=null)
{
if (attr.Description!=null) result["Description"] = OnLocalizeString(schema, "Description", attr.Description, isoLang);
var str = attr.StoreFlag==StoreFlag.OnlyStore || attr.StoreFlag==StoreFlag.LoadAndStore;
if (!str) result["Stored"] = str;
if (attr.Required) result["Required"] = attr.Required;
if (!attr.Visible) result["Visible"] = attr.Visible;
if (attr.Min!=null) result["MinValue"] = attr.Min;
if (attr.Max!=null) result["MaxValue"] = attr.Max;
if (attr.MinLength>0) result["MinSize"] = attr.MinLength;
if (attr.MaxLength>0) result["Size"] = attr.MaxLength;
if (attr.Default!=null) result["DefaultValue"] = attr.Default;
if (attr.ValueList.IsNotNullOrWhiteSpace())
{
var vl = OnLocalizeString(schema, "LookupDict", attr.ValueList, isoLang);
result["LookupDict"] = FieldAttribute.ParseValueListString(vl);
}
else
{
var valueList = valueListLookup!=null ? valueListLookup(this, row, fdef, target, isoLang)
: row.GetClientFieldValueList(this, fdef, target, isoLang);
if (valueList==null && attr.HasValueList)
valueList = attr.ParseValueList();
if (valueList!=null)
result["LookupDict"] = valueList;
}
if (attr.Kind!=DataKind.Text) result["Kind"] = MapCLRKindToJS(attr.Kind);
if (attr.CharCase!=CharCase.AsIs) result["Case"] = MapCLRCharCaseToJS(attr.CharCase);
}
if (attr.Metadata!=null)
{
foreach(var fn in METADATA_FIELDS)
{
var mv = attr.Metadata.AttrByName(fn).Value;
if (mv.IsNullOrWhiteSpace()) continue;
if (fn=="Description"||fn=="Placeholder"||fn=="LookupDict"||fn=="Hint")
mv = OnLocalizeString(schema, fn, mv, isoLang);
result[fn] = mv;
}
}
return result;
}