gpt4 book ai didi

jQuery TreeTable (cubicphase) - 如何从动态添加扩展节点切换到静态添加?

转载 作者:行者123 更新时间:2023-12-01 06:07:25 25 4
gpt4 key购买 nike

我想修改 ludo 中的 jquery.TreeTable.js 以使用 cell.find 方法来设置展开。

原始来源如下:

if(options.expandable) {
cell.prepend('<span style="margin-left: -' + options.indent + 'px; padding-left: ' + options.indent + 'px" class="expander"></span>');
$(cell[0].firstChild).click(function() { node.toggleBranch(); });

这是我想要的(有点):

        if(options.expandable) {
cell.find('.expander').click(function(){
node.toggleBranch();
});

我认为我已经接近但还没有完全达到......

原始源文件:Jquery.TreeTable.js

最佳答案

答案是重写整个库......从头开始,因为立方相树表最终由于各种原因而受到限制。此时,我已经有了自己的烘焙解决方案,效果非常好。

脚本示例:

if (children <= 0) {
$(this).addClass('no-children');
} else {
if ($(this).hasClass('expander')) {
$(this).bind('click',function() {
if ($(this).hasClass('collapsed')) {
expandchildrenbranches($(this));
$(this).removeClass('collapsed');
} else {
collapsechildrenbranches($(this));
$(this).addClass('collapsed');
}
});

} else {
$(this).find('.expander').bind('click',function() {
var row = $(this).parents('tr:first');

if (row.hasClass('collapsed')) {
expandchildrenbranches(row);
row.removeClass('collapsed');
} else {
collapsechildrenbranches(row);
row.addClass('collapsed');
}
});
}

关于jQuery TreeTable (cubicphase) - 如何从动态添加扩展节点切换到静态添加?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4272051/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com