lst_projet.DataController.DataSet.Locate('pm_id',vPm_ID,[]);
bl:= lst_projet.DataController.DataSet.getBookmark;
lst_projet.DataController.DataSet.GotoBookmark(bl);
lst_projet.SetFocus;
lst_projet.FocusedNode.Expanded:=true;

=======================

http://blog.163.com/bin0315@126/blog/static/40662642201284250445/

一、导出EXCEL   TXT   HTML:

uses cxTLExportLink;

cxExportTLToEXCEL(dm.SaveDialog.FileName,cxDBTreeList1,TRUE,TRUE);  //轉入EXCEL
cxExportTLToTEXT(dm.SaveDialog.FileName,cxDBTreeList1,TRUE,TRUE);     //轉入TXT
cxExportTLToHTML(dm.SaveDialog.FileName,cxDBTreeList1,TRUE,TRUE);     //轉入HTML

---------------------------------------------------------------------------------------------------------------

二、cxdbtreelist1共多少条记录:     showmessage(inttostr(cxtreelist1.VisibleCount));

cxdbtreelist1当前记录的索引:  showmessage(inttostr(cxTreeList1.FocusedNode.VisibleIndex));

cxdbtreelist1有多少列:             showmessage(inttostr(cxtreelist1.VisibleColumnCount));

cxdbtreelist1当前记录的层级:   showmessage(inttostr(cxTreeList1.FocusedNode.Level));

cxdbtreelist1自动展开:             cxtreelist1.fullexpand; //自动展开

cxdbtreelist1自动折叠 :               cxtreelist1.FullCollapse;

cxdbtreelist1取上级节点内容:   ShowMessage(cxdbTreeList1.FocusedNode.Parent.Values[0]);

三、新增、删除结点:

增加同级结点:

procedure Tfr_bommglin.cxButton1Click(Sender: TObject);
var node:TcxTreeListNode;
begin

node:=cxdbTreeList1.FocusedNode.Parent.AddChild;
   node.Values[0]:='aaaaa';
   node.Values[1]:=node.Level;

end;

增加下级节点:

procedure Tfr_bommglin.cxButton2Click(Sender: TObject);
var node:TcxTreeListNode;
begin
   node:=cxdbTreeList1.FocusedNode.AddChild;       //增加子节点在首记录:cxdbTreeList1.FocusedNode.AddChildFirst;
   node.Values[0]:='aaaaa';
   node.Values[1]:=node.Level+1;
   cxdbTreeList1.FocusedNode.Expanded:=true;  //展开子节点
end;

删除节点:

ClientDataSet1.GetBookmark;
cxdbTreeList1.FocusedNode.Delete;     //删除当前节点记录;删除当前节点的子节点:cxdbTreeList1.FocusedNode.DeleteChildren;
cxDBTreeList1.DataController.GotoBookmark;

多节点选择删除:

cxDBTreeList1.DeleteSelection

数据集控制:

cxDBTreeList1.DataController.dataset.GotoFirst; //GotoLast     gotonext    gotoprev   GotoBookmark

cxDBTreeList1.DataController.dataset.Append;         //cancel      updatedata

cxDBTreeList1.DataController.dataset.edit;

根据cxdbtreelist随clientdataset1记录定位:

首先:bl:=cxDBTreeList1.DataController.DataSet.GetBookmark;

接着:cxDBTreeList1.DataController.DataSet.GotoBookmark(bl);
          cxDBTreeList1.SetFocus;

多结点选择取记录:

for i:=0 to cxDBTreeList1.SelectionCount-1 do
     begin
       ShowMessage(cxDBTreeList1.Selections[i].Values[1]);
    end;

-------------------------------------------------------------------------------------------

三、增加节点图片:

先在窗体上放ImageList关联到cxDBTreeList,在cxDBTreeList的GetNodeImageIndex事件中写如下:

procedure cxDBTreeList1GetNodeImageIndex(Sender:TcxCustomTreeList; ANode: TcxTreeListNode; AIndexType:
                       TcxTreeListImageIndexType; var AIndex: TImageIndex);
 var
    i :Integer;
  begin
    //给树结点加上图标
    for i := 0 to ANode.ValueCount do
      begin
     if ANode.Level = 0 then
         begin
           ANode.ImageIndex := 0;
         end
       else
       if ANode.Level = 1 then
         begin
           ANode.ImageIndex := 2;
         end
       else
       if ANode.Level = 2 then
         begin
           ANode.ImageIndex := 1;
         end;
     end;
 end;

cxdbtreelist的按记录查找节点的更多相关文章

  1. 算法学习记录-查找——二叉排序树(Binary Sort Tree)

    二叉排序树 也称为 二叉查找数. 它具有以下性质: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值. 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值. 它的左.右子树也分别 ...

  2. DOM操作 ——如何添加、移除、移动、复制、创建和查找节点等。

    DOM操作 --如何添加.移除.移动.复制.创建和查找节点等. (1)创建新节点 createDocumentFragment() //创建一个DOM片段 createElement() //创建一个 ...

  3. (一)DOM 常用操作 —— “查找”节点

    在 DOM 树中,如果想要操作一个节点,那么首先要"查找"到这个节点.查找节点的方法由 Document 接口定义,而该接口由 JavaScript 中的 document 对象实 ...

  4. Selenium 查找节点

    Selenium 可以驱动浏览器完成各种操作,比如填充表单.模拟点击等.比如,我们想要完成向某个输入框输入文字的操作,总需要知道这个输入框在哪里吧?而 Selenium 提供了一系列查找节点的方法,我 ...

  5. 再谈树---无根树转有根树( dfs搜索转化+fa数组记录父节点) *【模板】

    #include <stdio.h> #include <string.h> #include <stdlib.h> #include <vector> ...

  6. javasript 的DOM 节点操作:创建,插入,删除,复制以及查找节点

    DOM 含义: DOM 是文档对象模型(Document Object Model) 是一种基于浏览器编程的一套API 接口,我W3C 出台推荐的标准.其赋予了JS 操作节点的能力,当网页被加载时,浏 ...

  7. JS中的DOM操作怎样添加、移除、移动、复制、创建和查找节点

    DOM操作怎样添加.移除.移动.复制.创建和查找节点? (1)创建新节点 createDocumentFragment() //创建一个DOM片段 createElement() //创建一个具体的元 ...

  8. Dom4j 查找节点或属性

    Dom4j  查找节点或属性 例如 1 查找下面xml中的student节点的age属性, xpathstr="/students/student/@age"; 2 查找下面xml ...

  9. cocoscreator查找节点的方法 (跟jquery find一样)

    var each = function(object, callback) { var type = (function() { switch (object.constructor) { case ...

随机推荐

  1. effective C++ 读书笔记 条款11

    条款11: 在operator= 中处理"自我赋值" 在实现operator=时考虑自我赋值是必要的就像 x=y .我们不知道变量x与y代表的值是否为同一个值(把x和y说成是一个指 ...

  2. vim中凝视多行python代码

    在vim中凝视多行python代码比較麻烦,主要由下面几种方法: (1)将须要凝视的代码以文档字符串的形式呈现 (2)将须要凝视的代码以函数的形式呈现 (3)使用vim自身快捷键 我们主要使用第三种方 ...

  3. SpringMVC + hibernate 配置文件

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="htt ...

  4. Codeforces Round #276 (Div. 1) A. Bits 贪心

    A. Bits   Let's denote as  the number of bits set ('1' bits) in the binary representation of the non ...

  5. 邪恶的C++

    曾经看到一篇很有趣的文章,今天转载一下.抱歉的是没有找到最原始的版本,算是遗憾吧. ---------- 华丽的分割线 ---------- Linus曾经(2007年9月)在新闻组gmane.com ...

  6. 批量梯度下降(Batch gradient descent) C++

    At each step the weight vector is moved in the direction of the greatest rate of decrease of the err ...

  7. VS2010中文注释带红色下划线的解决方法

    环境:Visual Studio 2010 问题:代码中出现中文后会带下划线,很多时候感觉很不舒服.找了很久的原因没找到,后来无意中在VisualAssist X里找到了解决办法. 1.安装完Visu ...

  8. PCB 奥宝LDI 输出正负片转换关系

    今天继续对P2 奥宝LDI改造,在文件输出的时候遇到了一个正负片转换问题,研究了半天一直没有得到解决, 回来后前前后后整理今天参数输出与输出的关系,最终还梳理清楚了, 今天小结:一项技术只要用心去研究 ...

  9. preg_match_all匹配网络上文件

    <?php$ssa=file_get_contents("http://www.oschina.net/code/snippet_4873_5256");preg_match ...

  10. BZOJ 4010 拓扑排序+heap

    思路: 反向图求最大拓扑序 反向输出 //By SiriusRen #include <queue> #include <cstdio> #include <cstrin ...