![]() |
1.支持Shift+鼠标、Ctrl+鼠标的多行选择;表头鼠标右键菜单有“全选”、“反选”;
2.用鼠标进行Treelist之间的单行拖曳、多行拖曳; 3.表二支持自我拖曳; 4.切换成“以树方式显示”,相互拖拽; 5.单列多层树也能相互拖拽,请 |
| 表一 | 表二 | |
![]() |
|
1.查看创建该TreeList的XML描述文件; 2.源码分析:页面中创建Treelist控件实例的js如下:
<script language="JavaScript">
var countForFirefox=0;
var AF1Ready = 0, AF2Ready = 0;
function OnReady(id)
{
cooper(id);
}
function cooper(id) {
if($B.type == "firefox") {
countForFirefox++;
if(countForFirefox != 5) return;
id='';
}
if(id=='AF1' || id=='') {
AF1.func("Build", "treelist/citymulti.xml");
AF1.func("Load", "treelist/city.xml \r\n Node=\\Table\\TR"); //加载指定节点的XML数据
AF1Ready = 1;
}
if(id=='AF2' || id=='') {
AF2.func("Build", "treelist/citymulti.xml");
AF2Ready = 1;
}
if(id=='AF3' || id=='') {
AF3.func("Build", "treelist/t2.xml \r\n editAble=false; treeformat='format=byid;autoid=true'");
AF3.func("HideCol", "kmdm \r\n true");
AF3.func("Load", "treelistdata/km.json.txt");
var handle=AF3.func("GetHandle", "");
AF3.func("EnableDrag", handle);
}
if(id=='AF4' || id=='') {
AF4.func("Build", "treelist/t7.xml");
var handle=AF4.func("GetHandle", "");
AF4.func("EnableDrag", handle);
}
if(AF1Ready==1 && AF2Ready==1) {
enableDrag();
AF1Ready = AF2Ready = -1;
}
}
//用于Firefox页面的 onLoad
function onPageLoad( )
{
if($B.type == "firefox") cooper('');
}
//Main: Enable拖曳操作
function enableDrag( )
{
//Enable AF1 、 AF2 相互拖曳
var handle=AF1.func("GetHandle", "");
AF2.func("EnableDrag", handle);
//Enable AF2 自我拖曳
handle=AF2.func("GetHandle", "");
AF2.func("EnableDrag", handle);
}
//按钮的功能: 重新执行Build( ),换成另一个Treelist
function rebuild( )
{
AF1.func("Build", "treelist/t2.xml \r\n editAble=false");
AF1.func("Load", "treelistdata/km.json.txt");
AF2.func("Build", "treelist/t2.xml \r\n editAble=false");
}
</script>
<body onload='onPageLoad( )' ...
3.增强功能:Treeformat 的 "autoid=true"子句效果: 任意拖拽。 即任一行可拖拽到另一行的前、后、或作为子孙. |
| 4.同上,但 Treeformat 为 "byPid"。 拖拽后,Id 始终保持不变,但其 Pid 能自动更新。 这是它的XML模式文件 |