How do I autosize the column in SlickGrid?

PJ. picture PJ. · Jul 22, 2011 · Viewed 26.1k times · Source

I want slickgrid to autosize the columns based on the widest content or header text - whichever is wider. In simpler terms, I want it to simulate the default behavior of regular HTML tables when it comes to column sizing. How can I do it in slickgrid?

Answer

csigrist picture csigrist · Jan 17, 2012

When constructing your options, you can use forceFitColumns: true

var options = {
    enableCellNavigation: true,
    forceFitColumns: true
};

This will make the columns fill the entire width of your grid div.