仅当列等于某个值时,数据表组才会折叠

问题描述

我正在使用数据表和行组扩展来呈现数据和折叠组。一切正常,但我不知道如何实现以下目标:

目前,当加载表时,每个组都会折叠。我有一个状态列(第 0 列),如果状态列 0 的值为“草稿”,我想禁用折叠。

这是我的行组部分,基于一个众所周知的例子。

rowGroup: {
            startRender: function(rows,group,level) {
                var all;

                if (level === 0) {
                    top = group;
                    all = group;
                } else {
                    // if parent collapsed,nothing to do
                    if (!!collapsedGroups[top]) {
                        return;
                    }
                    all = top + group;
                    if (collapsedGroups[all] === undefined) {
                        collapsedGroups[all] = true;
                    }
                }

                var collapsed = !!collapsedGroups[all];

                rows.nodes().each(function(r) {
                    r.style.display = collapsed ? 'none' : '';

                });

                // Add category name to the <tr>. NOTE: Hardcoded colspan

                return $('<tr/>')
                    .append('<td colspan="9"><b>Request from ' + group + ' (' + rows.count() + ' references returned)</b></td>')
                    .attr('data-name',all);
                    .toggleClass('collapsed',collapsed);
            },dataSrc: ['date']
        }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)