EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: tmark on May 05, 2013, 10:29:34 AM



Title: Datagrid only one column permanent 100% width
Post by: tmark on May 05, 2013, 10:29:34 AM
Hi all

I have only one column in a datagrid.
When I resize the datagrid, the column does not follow it.

At first, how can I set 100% width of the column?
And at second, is it possible to have a permanent 100% width column in the datagrid?

Thanks.


Title: Re: Datagrid only one column permanent 100% width
Post by: Kevin on May 13, 2013, 06:18:35 AM
Hi tmark

Try using the fitColumns option. ie
Code:
<table id="dg" class="easyui-datagrid" title="DataGrid with Toolbar" data-options="fitColumns:true, fit:true">  
   <thead> 
      <tr> 
         <th field="itemid" width="100%">Col 1</th> 
      </tr>                           
   </thead>                             
   <tbody>                             
      <tr>                             
         <td>7</td>             
      </tr>                           
   </tbody>                             
</table> 

Note: I had to set the column width to 100%. Without this, the column width is first set to a calculated width (header text width). Then when you resize the column (does not matter what size), it automatically jumps to the max size.