表一和表二填入了相同的数据,请注意表中红色的“客户”列,表一是没有任何引用的纯TreeList,“客户”列内容就是客户代码; 而表二的“客户”列嵌套引用了1个外部TreeList,实现了类似主-外键关联的列展示。
表一

表二



1.表一和表二加载的数据是一样的,差别在于XML描述文档,请打开表一的XML描述文件表二的XML描述文件;
2.比较其差异, 会发现表二的CustomerID(客户)列引用了一个外部的Treelist: customer.xml
3.这是类似复用主-外键视图的原理图
4.源码分析:本页面中和Treelist有关的js源码如下:
function OnReady(id)
{
 if(id=='AF1') {
  AF1.func("Build", "treelist/orders1.xml");
  AF1.func("Load", "treelistdata/orders.txt");
 }
 else if(id=='AF2') {
  AF2.func("Build", "treelist/orders2.xml");
  AF2.func("Load", "treelistdata/orders.txt");
 }
}
5.另外,这2个XML模版中都设定了 alternateColor, 即斑马线色:
<?xml version="1.0" encoding="utf-8"?>
 <TreeList>
  <Properties key="OrderID" curSelColor="#000000" bgColor="#eefdff" alternateColor="#ccffcc"/>
  <Fonts>
  ...