powerconsulting/jquery.tabelizer

Only two level

Opened this issue · 4 comments

cattura
How can I do this correctly? Without left expander and without the possibility to expand itself.
I need only two level and the plugin seems to work with only 4 levels.

Thanks a lot.

I wanted to prevent putting the css inline, which is why I did it this way to start with.
What would make sense is to generate the css classes dynamically.

I'm not good enough with CSS, please help me with this awesome plugin, i need only 3 levels

+1. How fix it?

As a temporary solution. Just that it will be possible then to integrate into the library.

$(document).ready(function() {
    var tables = $('.tabelizer-table');

    tables.tabelize({
        fullRowClickable: false
    });

    tables.each(function(index, table) {
        var elements = $(table).find('tr');
        elements.each(function(index, element) {
            var tr = $(this);
            var trLevel = $(this).attr('data-level');

            var nextTr = $(elements[index + 1]);
            var nextTrLevel = nextTr.attr('data-level');

            if (index !== elements.length - 1) {
                if ($.isNumeric(trLevel) && $.isNumeric(nextTrLevel)) {
                    if (nextTrLevel <= trLevel) {
                        tr.find('.expander')
                            .first()
                            .off()
                            .css('opacity', 0);
                    }
                }
            } else {
                if (trLevel == 1) {
                    tr.find('.expander')
                        .first()
                        .off()
                        .css('opacity', 0);
                }
            }
        });
    });
});