public override TreeCodeTableModel GetChildrenNode(string key) { var ds = getDataSet(0, "", string.Format(ObjectUtil.SysCulture, " {0} = '{1}' " + where (), ParentIdField, key), null); TreeCodeTableModel root = new TreeCodeTableModel() { CODE_TEXT = "", CODE_VALUE = key, IsLeaf = false, isParent = true, nocheck = OnlyLeafCheckbox ? true.Value <bool?>() : null //IsSelect = true }; root.Children = SelectTree(ds.Tables[0]); return(root); }
public string LoadTreeFormatJson(string regName, string ds) { SetPostDataSet(ds); var dt = GetCodeTableInstance(regName); TreeCodeTable cdm = dt as TreeCodeTable; // cdm.Initialize(PostDataSet); TreeCodeTableModel result = null; string key = ""; bool isCodeValue = HasCodeValue(cdm, ref key); if (isCodeValue) { result = cdm.GetDisplayTreeNode(key); if (result == null) { result = cdm.GetChildrenNode(cdm.Root); } } else { result = cdm.GetChildrenNode(cdm.Root); } //FormaterTreeText(result); //if (result != null && result.Children != null) //{ if (result.CODE_VALUE == "0") { return(ReturnJson(result.Children.ToArray())); } else { if (result.Children.Count() == 1) { if (result.Children.First().CODE_VALUE == cdm.Root) { return(ReturnJson(result.Children.ToArray())); } } result.CODE_TEXT = cdm[result.CODE_VALUE].CODE_TEXT; //result.open = true; } //} //else return(ReturnJson(new TreeCodeTableModel[] { result })); //return FastJson(result); }