RM.Web/Themes/Scripts/TreeTable/jquery.treeTable.js

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
 * jQuery treeTable Plugin 2.3.0
 * http://ludo.cubicphuse.nl/jquery-plugins/treeTable/
 *
 * Copyright 2010, Ludo van den Boom
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */

(function ($) {
    // Helps to make options available to all functions
    // TODO: This gives problems when there are both expandable and non-expandable
    // trees on a page. The options shouldn't be global to all these instances!
    var options;
    var defaultPaddingLeft;

    $.fn.treeTable = function (opts) {
        options = $.extend({}, $.fn.treeTable.defaults, opts);

        return this.each(function () {
            $(this).addClass("treeTable").find("tbody tr").each(function () {
                // Initialize root nodes only if possible
                if (!options.expandable || $(this)[0].className.search(options.childPrefix) == -1) {
                    // To optimize performance of indentation, I retrieve the padding-left
                    // value of the first root node. This way I only have to call +css+ 
                    // once.
                    if (isNaN(defaultPaddingLeft)) {
                        defaultPaddingLeft = parseInt($($(this).children("td")[options.treeColumn]).css('padding-left'), 10);
                    }

                    initialize($(this));
                } else if (options.initialState == "collapsed") {
                    this.style.display = "none"; // Performance! $(this).hide() is slow...
                }
            });
        });
    };

    $.fn.treeTable.defaults = {
        childPrefix: "child-of-",
        clickableNodeNames: false,
        expandable: true,
        indent: 15,
        initialState: "collapsed",
        treeColumn: 0
    };

    // Recursively hide all node's children in a tree
    $.fn.collapse = function () {
        $(this).addClass("collapsed");

        childrenOf($(this)).each(function () {
            if (!$(this).hasClass("collapsed")) {
                $(this).collapse();
            }

            this.style.display = "none"; // Performance! $(this).hide() is slow...
        });

        return this;
    };
后面还有 160 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。