protected void trvEmpleados_CustomCallback(object sender, TreeListCustomCallbackEventArgs e) { string strKey = ""; List <TreeListNode> lstSelectedNodes = trlEmpresaRep.GetSelectedNodes(); foreach (TreeListNode Node in lstSelectedNodes) { strKey += Node.Key + ","; } strKey = strKey.Substring(0, strKey.Length - 1); Session["DepartamentoSelected"] = strKey; DataTable dtbEmpleados = (DataTable)Session[Constantes.SesionTblEmpleadosSm]; String strFilter = Constantes.ColumnaEmpleadoDefaultDepId + " in (" + strKey + ")"; DataRow[] dtrFilter = dtbEmpleados.Select(strFilter); DataTable dtbFilter = dtbEmpleados.Clone(); foreach (DataRow row in dtrFilter) { dtbFilter.ImportRow(row); } Session[Constantes.SesionTblEmpleadosSm1] = dtbFilter; ASPxTreeList treeList = (sender as ASPxTreeList); treeList.DataSource = dtbFilter; treeList.DataBind(); treeList.ExpandAll(); }
private void TreeListDepartmentReceived_Load(object sender, EventArgs e) { if (isFirstLoad && View.ObjectSpace.Owner is DetailView && treeList != null) { treeList.Width = new Unit(90, UnitType.Percentage);; treeList.Height = new Unit(100, UnitType.Percentage); treeList.Settings.ScrollableHeight = 350; treeList.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; treeList.SettingsPager.Visible = false; //Expand rồi collapse đảm bảo mọi node được load ở server side hạn chế load ở client side treeList.ExpandAll(); treeList.CollapseAll(); treeList.SettingsPager.Summary.Visible = false; treeList.SettingsPager.PageSize = 500; treeList.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; /// Turn off this shit before select node //2. Selected/chọn những Department/phòng tương ứng DetailView dvOwner = View.ObjectSpace.Owner as DetailView; if (dvOwner != null && dvOwner.CurrentObject != null && dvOwner.CurrentObject is Document) { Document curDoc = dvOwner.CurrentObject as Document; if ((curDoc.EmployeeReceiveds.Count > 0)) { ///((ASPxTreeList)sender).ExpandAll(); //New_Object => không expaned all // Check những phòng ban có trong list treeList.SettingsBehavior.ProcessSelectionChangedOnServer = false; foreach (Employee emp in curDoc.EmployeeReceiveds.Where(emp => emp != null)) { var node = treeList.FindNodeByKeyValue(emp.Oid.ToString()); if (node != null) { node.Selected = true; if (node.ParentNode != null) { node.ParentNode.Expanded = true; } } } treeList.SettingsBehavior.ProcessSelectionChangedOnServer = true; } } isFirstLoad = false; //Done turn it on again } }
protected void TreeList_DataBound(object sender, EventArgs e) { if (!IsCallback && !IsPostBack) { ASPxTreeList tree = sender as ASPxTreeList; tree.ExpandAll(); } }
void findNodeAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) { string searchText = e.ParameterCurrentValue as String; if (!String.IsNullOrEmpty(searchText)) { treeList.ExpandAll(); } }
protected void LinkButton_Expand_Click(object sender, EventArgs e) { ASPxTreeList_ViTri.ExpandAll(); }