DHTMLX Docs & Samples Explorer

### Autowidth for column(s)

Using * symbol instead of column width, you can set auto width in the grid.
Try to resize column. Book Title column will take all available space after resizing other columns.

Source

    <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxgrid.css">
    <link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxgrid_dhx_skyblue.css">
    <script  src="../../codebase/dhtmlxcommon.js"></script>
    <script  src="../../codebase/dhtmlxgrid.js"></script>
    <script  src="../../codebase/dhtmlxgridcell.js"></script>

    <div id="gridbox" style="width:700px; height:270px; background-color:white;overflow:hidden"></div>
    <script>mygrid = new dhtmlXGridObject('gridbox');
    mygrid.setImagePath("../../codebase/imgs/");
    mygrid.setHeader("Sales,Book Title,Author,Price,In Store,Shipping,Bestseller,Date of Publication");
    mygrid.setInitWidths("50,*,120,80,70,80,70,100");
    mygrid.setColAlign("center,left,left,right,center,left,center,center");
    mygrid.setColTypes("dyn,ed,ed,price,ch,co,ra,ro");
    mygrid.setColSorting("int,str,str,int,str,str,str,date");
    mygrid.enableMultiselect(true);
    mygrid.init();
    mygrid.setSkin("dhx_skyblue");
    mygrid.loadXML("../common/grid.xml");</script>