private static List <DynamicObj> PrepareFieldList(IDBEntity entity) { var fields = entity.GetLayoutFields(EntityLayoutType.None); var coll = new List <DynamicObj>(); foreach (var f in fields) { var d = new DynamicObj(); d.Add("Name", f.Name); d.Add("Text", f.Text); d.Add("Type", f.Type); d.Add("WidgetType", f.ControlType); d.Add("Isrequired", f.IsRequired); d.Add("ShouldFullRow", EntityLayoutService.IsWidgetOnFullRow(f.ControlType)); coll.Add(d); } return(coll); }
public static TView CreateDefault(IDBEntity Entity, EntityLayoutType layoutType) { var view = new TView(); view.Fields = new List <TField>(); var page = new TPage(); view.Pages.Add(page); var group = new TGroup(); page.Groups.Add(group); var start_new_r = true; List <TCol> col_r = new List <TCol>(); var layoutF = Entity.GetLayoutFields(EntityLayoutType.Edit); int idx = 0; foreach (var f in layoutF) { var col = new TCol(f.Name); view.Fields.Add(new TField() { FieldId = f.Name, Text = f.Text }); if (col_r.Count == 1) { start_new_r = true; } else { start_new_r = false; } if (IsWidgetOnFullRow(f.ControlType)) { start_new_r = true; var row = new TRow(); col.Span = 24; row.Cols = new List <TCol>() { col }; group.Rows.Add(row); } else { col_r.Add(col); } if (start_new_r) { var row = new TRow(); row.Cols = col_r; group.Rows.Add(row); col_r = new List <TCol>(); } else if (layoutF.Count - 1 == idx) { var row = new TRow(); row.Cols = col_r; group.Rows.Add(row); } idx++; } return(view); }