public ActionResult GetGridFields() { JsonResult json = new JsonResult(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; string groupName = Request["searchGroup"]; GridColumns gcs = GridManager.GetGridFields(groupName, "default"); string versions = Request["Version"]; if (!String.IsNullOrWhiteSpace(versions)) { string[] vs = versions.Split(';', ','); if (vs.Length > 0) { for (int i = vs.Length - 1; i >= 0; i--) { if (!String.IsNullOrWhiteSpace(vs[i])) { string v = vs[i].Trim(); gcs.colNames.Insert(gcs.colNames.Count, v); GridColumnModel model = new GridColumnModel(); model.name = v; model.index = v; model.width = 80; model.align = "right"; gcs.colModel.Insert(gcs.colModel.Count, model); } } } } json.Data = gcs; return json; }
public static GridColumns GetGridFields(string listName, string uid) { FieldGroup fieldGroup = new FieldGroup(listName); FieldGroupDetailCollection fieldDetails = fieldGroup.GetFieldsByUser(uid); GridColumns gridColumns = new GridColumns(); List<string> colNames = new List<string>(); List<GridColumnModel> colModels = new List<GridColumnModel>(); foreach (FieldGroupDetail field in fieldDetails) { colNames.Add(field.DisplayName); GridColumnModel model = new GridColumnModel(); model.name = field.FieldName; model.index = field.FieldName; model.width = field.Width_Detail > 0 ? field.Width_Detail : field.Width; model.align = field.Align; colModels.Add(model); } return new GridColumns { colNames = colNames, colModel = colModels }; }