// drag-and-drop to a new parent node protected void ASPxTreeList1_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { SampleDataItem child = e.Node.DataItem as SampleDataItem; SampleDataItem newParent = e.NewParentNode.DataItem as SampleDataItem; child.Parent = newParent.Pk; e.Handled = true; }
void treeList_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { //--如果目标节点和移动节点属于同一个父节点下,前两者不同,则执行移动操作 if (e.Node.ParentNode.Key == e.NewParentNode.ParentNode.Key && e.Node.Key != e.NewParentNode.Key) { ygAdapter.MoveNode(e.Node.Key, e.NewParentNode.Key, e.Node.ParentNode.Key); treeList.DataBind(); } e.Cancel = true; }
public static void DragAndDropNode(ASPxTreeList treeList, TreeListNodeDragEventArgs e) { XmlDataSource xmlDataXource = treeList.Page.FindControl(treeList.DataSourceID) as XmlDataSource; XmlDocument docum = xmlDataXource.GetXmlDocument(); XmlNode oldChildNode = FindNode(docum, e.Node.GetValue("Id")); XmlNode parentNode = FindNode(docum, e.NewParentNode.GetValue("Id")); ReplaceNode(docum, parentNode, oldChildNode); RearrangeAndSaveXml(docum); }
protected void TreeList_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { if (e.Node != null && e.NewParentNode != null) { SampleDataItem child = dataHelper.Data.Find(i => i.Key == Convert.ToInt32(e.Node.Key)); SampleDataItem newParent = dataHelper.Data.Find(i => i.Key == Convert.ToInt32(e.NewParentNode.Key)); child.ParentKey = newParent.Key; TreeList.DataSource = dataHelper.Data; ((ASPxTreeList)sender).DataBind(); e.Handled = true; } }
protected void ASPxTreeList1_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { e.Handled = true; var nodes = ASPxTreeList1.GetSelectedNodes(); if (nodes.Count == 0) { DataHelper.MoveNode(Convert.ToInt32(e.Node.Key), Convert.ToInt32(e.NewParentNode.Key)); } else { DataHelper.MoveNodes(nodes, Convert.ToInt32(e.NewParentNode.Key)); } }
protected void tree_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { string oldPath = e.Node.GetValue(FileManagerHelper.FullPathName).ToString(); //string destination = e.NewParentNode == tree.RootNode // ? FileManagerHelper.RootFolder // : e.NewParentNode.GetValue(FileManagerHelper.FullPathName).ToString(); string destination = e.NewParentNode == tree.RootNode ? FileManagerHelper.CurrentDataFolder : e.NewParentNode.GetValue(FileManagerHelper.FullPathName).ToString(); string newPath = destination + Path.DirectorySeparatorChar + Path.GetFileName(oldPath); FileManagerHelper.MovePath(oldPath, newPath); tree.RefreshVirtualTree(); e.Handled = true; }
protected void treeList_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { bool isDragNodeExpanded = e.Node.Expanded; bool isDropNodeExpanded = e.NewParentNode.Expanded; if (e.NewParentNode.Key == "*") { ChecklistTemplateItems.DeleteChecklistItem(decimal.Parse(e.Node.Key)); //soft delete status = status | 4 } else { decimal parentckey = decimal.Parse(e.NewParentNode.Key.Replace("*", "")); decimal nodekey = decimal.Parse(e.Node.Key); string checklistckey = ddChecklists.SelectedValue; List <ChecklistTemplateVersion> versions = ChecklistTemplateVersion.GetChecklistTemplateVersions(decimal.Parse(checklistckey)); decimal versionckey = versions[0].ChecklistTemplateVersionCKey; ChecklistTemplateItems.DragDropItem(versionckey.ToString(), nodekey.ToString(), parentckey.ToString()); if (e.Node.Key == e.NewParentNode.Key) { } else { } } //e.Node.Expanded = isDragNodeExpanded; //e.NewParentNode.Expanded = false; //isDropNodeExpanded; e.Handled = true; LoadChecklists(); BindChecklists(); LoadChecklistItems(); BindChecklistTree(); }
// เรียงลำดับหน่วยงาน protected void ASPxTree_ORG_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { // child คือรายการที่กดย้าย // Parent รายการที่ child ย้ายเพื่อต่อท้ายรายการ List<OrgGetDataDemo> list = new List<OrgGetDataDemo>(); OrgGetDataDemo child = e.Node.DataItem as OrgGetDataDemo; OrgGetDataDemo newParent = e.NewParentNode.DataItem as OrgGetDataDemo; // หารายการ Datatable ผู้ประเมินปัจจุบัน Row_Index string Child_Row_Index = ""; string Child_person_id = ""; string newParent_Row_Index = ""; string newParent_person_id = ""; Add_Approver = ""; DataTable DT = CurrentData_Approver(); // หา child ของรายการผู้ประเมิน DT.DefaultView.RowFilter = " Row_Index='" + child.Row_Index + "'"; Child_Row_Index = DT.DefaultView[0]["Row_Index"].ToString(); Child_person_id = DT.DefaultView[0]["person_id"].ToString(); // หา parent ของรายการผู้ประเมิน DT.DefaultView.RowFilter = " Row_Index='" + newParent.Row_Index + "'"; newParent_Row_Index = DT.DefaultView[0]["Row_Index"].ToString(); newParent_person_id = DT.DefaultView[0]["person_id"].ToString(); //Reorder_Approver(Child_person_id, newParent_person_id, newParent_Row_Index); DataTable DT_Temp; //DT.DefaultView.RowFilter="0=1"; DT_Temp = DT.DefaultView.ToTable(); DataRow DR = null; //DR = DT.Rows[child.Row_Index -1]; //DR["Row_Index"] = GL.CDBL(newParent_Row_Index) + (0.5); for (int i = 0; i <= DT.Rows.Count - 1; i++) { DR = DT.Rows[i]; if (GL.CINT(DT.Rows[i]["Row_Index"]) == GL.CINT(child.Row_Index)) { DR["Row_Index"] = GL.CDBL(newParent_Row_Index) + (0.5); } } DT.DefaultView.RowFilter = null; DT.DefaultView.Sort = "Row_Index asc"; DT_Temp = DT.DefaultView.ToTable(); // เรียงลำดับผู้ประเมินใหม่ //DataTable DT_Temp; DT_Temp = DT.DefaultView.ToTable(); //DT_Temp.DefaultView.Sort = ""; //DT_Temp = null; //DT_Temp = DT.DefaultView.ToTable(); //DT_Temp = DT_Temp.DefaultView.ToTable(); DataRow DR_Temp; for (int i = 0; i <= DT_Temp.Rows.Count - 1; i++) { DR_Temp = DT_Temp.Rows[i]; DR_Temp["Row_Index"] = i + 1; OrgGetDataDemo data = new OrgGetDataDemo(); data.Row_Index = i + 1; data.Approver_ID = DT_Temp.Rows[i]["person_id"].ToString(); data.Approver_Name = DT_Temp.Rows[i]["staff_name"].ToString(); if (DT_Temp.Rows[i]["approve_date"].ToString() != "") { data.approve_date = DT_Temp.Rows[i]["approve_date"].ToString(); } else { data.approve_date = ""; } list.Add(data); } Session["DT_Current"] = DT_Temp; Session["list_Current"] = list; //LogFileEng.SaveActionTransLog("HRM_UT0502", "Swap Approver", "จัดลำดับผู้อนุญาต", "CTLT_ORGANIZE", "เลื่อนหน่วยงาน ORG_SERIAL='" + child.ORG_SERIAL + " อยู่ภายใต้ ORG_SERIAL='" + newParent.ORG_SERIAL + "'", "", Request); BindORG(LeaveNote_ID); e.Handled = true; }
protected void ASPxTreeList1_ProcessDragNode(object sender, TreeListNodeDragEventArgs e) { XmlHelper.DragAndDropNode(sender as ASPxTreeList, e); e.Handled = true; }