Muiter
Muiter

Reputation: 1520

Losing width 100% when toggle visibility of table

I have set the start of my table like this

<table class="table" width="100%" id="table_details['.$i.']" style="display:none">

And there is a working function to toggle the visibility this table.

function expand_table(selectVeld, nr)
{
    var div = document.getElementById('table_details['+nr+']');
    if (div.style.display !== 'none') {
        div.style.display = 'none';
        document.getElementById('table_details_glyp['+nr+']').className = "fas fa-angle-up pull-right";
    }
    else {
        div.style.display = 'block';
        document.getElementById('table_details_glyp['+nr+']').className = "fas fa-angle-down pull-right";
    }
}

The table should like this when visible

For some reason the table is not expanding to 100% when making it visible

The same problem occurs when I put this function in a div and place the table in this div. Any suggestions to stretch the table to 100%?

Upvotes: 0

Views: 78

Answers (1)

Pooja Roy
Pooja Roy

Reputation: 545

If You are Using Bootstrap You can use col-md-12 before table.

If not Please expand parent div width to 100%

.parentDiv
{
 width:100%;
 float: left;
}

Upvotes: 1

Related Questions