jQuery MiniUI
标题:
treegrid有办法让他显示分级列表号吗? 1.1.2.3这样
[打印本页]
作者:
cciikk
时间:
2020-8-10 23:12:56
标题:
treegrid有办法让他显示分级列表号吗? 1.1.2.3这样
1
2
3
4
4.1
4.2
4.3
4.3.1
4.3.2
5
6
7
类似这样的分级列表怎么实现呢?
作者:
felt
时间:
2020-8-11 09:52:46
通过ondrawcell来绘制。
ondrawcell="onDrawCell"
function onDrawCell(e) {
var column = e.column;
if (column.type && column.type == "indexcolumn") {
var tree = e.sender;
var node = e.record;
var level = tree.getLevel(node);
var html = "";
for (var i = 0; i < level + 1; i++) {
if (i != level) {
html = getLevelStr(node) + ".";
} else {
html = getLevelStr(node);
}
}
function getLevelStr(node) {
var pnode = tree.getParentNode(node);
if (!pnode) return "";
var index = "";
var pIndex = getLevelStr(pnode)
if (pIndex !== "") {
index += pIndex + ".";
}
var children = tree.getChildNodes(pnode);
index += (children.indexOf(node) + 1);
return index;
}
e.cellHtml = html;
}
}
复制代码
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2