Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Eben on Mar 12, 2008 10:36
open dhtmlx forum
link column type width issue

I have a grid being created from an html table. One of the columns is a link type. The column width is getting set much wider than any of the content in the any of the rows, including the header. This is subsequently forcing a horizontal scrollbar to appear for the gridbox div, which is contained in another fixed width div.

My uneducated guess is that despite the link appearing properly, the column is still formatting to the actual characters that make up the link html...?
Answer posted by Support on Mar 12, 2008 11:27
By default grid takes width of grid columns on moment of initialization, so if width was nod defined explicitly - it may be a reason of problem.

If problem still occurs for you - please provide a snippet of HTML code from which you generating grid.
Answer posted by Eben on Mar 12, 2008 11:48
This is the html that is generating the grid, as you can see no widths have been defined.  The Name column winds up being much wider than necessary.

<div style="width: 200px;">
<table border="0" class="dhtmlxGrid" forceCellTypes="true" name="xgrid" id="xgrid" evenrow="even" unevenrow="uneven" imgpath="/images/xgrid/" gridHeight="auto" gridWidth="100%">
    <tr>
        <td type="ed" sort="int">Total</td>
        <td type="link">Name</td>
    </tr>
    <tr>
        <td align="right">400</td>
        <td>All^javascript:do_search(1,"all");^_self</td>
    </tr>
     <tr>
         <td align="right">200</td>
         <td>Some Data^javascript:do_search(1,2);^_self</td>
      </tr>
</table>
</div>
Answer posted by Support on Mar 13, 2008 02:22
In case when width not set - it taken from original HTML table, in which it was wider because of url strings.
You can

a) define fixed height

<div style="width: 200px;">
<table border="0" class="dhtmlxGrid" ...
    <tr>
        <td type="ed" sort="int">Total</td>
        <td width="100" type="link">Name</td>
    </tr>
    <tr>
        <td align="right">400</td>
        <td>All^javascript:do_search(1,"all");^_self</td>
    </tr>

or

b) auto size second column

<table border="0" class="dhtmlxGrid" oninit="xgrid.adjustColumnSize(1)" ...
    <tr>
        <td type="ed" sort="int">Total</td>
        <td width="100" type="link">Name</td>
    </tr>
    <tr>
        <td align="right">400</td>
        <td>All^javascript:do_search(1,"all");^_self</td>
    </tr>