column hiding and widths

column hiding and widths

johnblythejohnblythe Posts: 92Questions: 21Answers: 2

hi there,

i had written my own version of the old ColVis plugin a few months ago (tragically it was about 2w before you came out with the latest release and a more robust, efficient version of it doh!). I do something like this:

if (toggleColsOn.length > 0) dtApi.columns(toggleColsOn).visible(1, true); redraw = true;
                if (toggleColsOff.length > 0) dtApi.columns(toggleColsOff).visible(0, true); redraw = true;
                if (redraw) dtApi.columns.adjust().draw(false);

I track what the user wants to add/remove from their view and then upon clicking an update function build out the specs to pass on to the columns(myArray).visible() method.

The issue is that my table shrinks when I do this rather than staying full within the modal it's operating in, the original bounds of the <div> it is nested in. What would be the best way to maintain a full width here?

Best,

Answers

  • jr42.gordonjr42.gordon Posts: 305Questions: 2Answers: 49
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Actually, simply adding width="100%" as an attribute to your HTML table is the way to do this.

    I've been considering removing the ability to disable autoWidth. I probably won't, but it is an option for the next major version.

    Allan

This discussion has been closed.