public JsonResult GetButtonList() { string id = QueryString("listId"); ListConfig fc = UnitOfWork.GetByKey <ListConfig>(id); fc.CheckNotNull("ListConfig"); return(Json(fc.GetButtonList())); }
private List <Button> GetButtonList(ListConfig list) { List <Button> buttonList = new List <Button>(); var buttonDicList = list.GetButtonList(); foreach (var buttonDic in buttonDicList) { var detailDic = buttonDic.GetValue("Detail").JsonToDictionary(); var attr = new Dictionary <string, object>(); string title = buttonDic.GetValue("title"); buttonDic.Remove("title"); if (!string.IsNullOrEmpty(detailDic.GetValue("onclick"))) { if (!string.IsNullOrEmpty(detailDic.GetValue("mustSelect"))) { string action = string.Format("checkSelection(\"{0}\",\"{1}\")", detailDic.GetValue("mustSelect"), detailDic.GetValue("onclick")); buttonDic.SetValue("onclick", action); } else { buttonDic.SetValue("onclick", detailDic.GetValue("onclick")); } } else if (!string.IsNullOrEmpty(buttonDic.GetValue("url"))) { string url = buttonDic.GetValue("url"); //高宽 string width = detailDic.GetValue("width"); string height = detailDic.GetValue("height"); if (!string.IsNullOrEmpty(detailDic.GetValue("mustSelect"))) { string clickCmd = "\"openWindowWithUrl(\\\"" + url + "\\\",\\\"" + width + "\\\",\\\"" + height + "\\\")\""; string action = string.Format("checkSelection(\"{0}\",{1})", detailDic.GetValue("mustSelect"), clickCmd); buttonDic.SetValue("onclick", action); } else { string clickCmd = "openWindowWithUrl(\"" + url + "\")"; buttonDic.SetValue("onclick", clickCmd); } buttonDic.Remove("url"); } var classNames = new List <string>(); if (buttonDic.GetValue("hidden").ToLower() == "true") { classNames.Add("euiCtrlHidden"); } EasyUICtrlPrepareData pData = new EasyUICtrlPrepareData() { Attr = buttonDic, ClassNames = classNames }; Button dg = new Button(buttonDic.GetValue("id"), pData, title); dg.Prepare(); buttonList.Add(dg); } return(buttonList); }