Hi
I have image tag(width=100px) in cell. On loading of grid, cell gets perfect width as of image tag.
but When I call adjustColumnSize function on the same column, The size of column shrinks.
I think function does not consider the width of image tag, it only takes the size of max cell data.
How I can solve this issue?
I think function does not consider the width of image tag, it only takes the size of max cell data.
In case of IE - real width of cell taken, but in FF there is no way to detect real width of content in cell, so code build rough value based on cell text content.
>>How I can solve this issue?
There is no way to fully resolve issue, but you can define min width of column
grid.setColumnMinWidth(100,index);
so at least the column will not be lesser than default image width
Thanks.
>> grid.setColumnMinWidth(100,index);
Actually I want to handle only when there is image in cell and above will do for all data.
I just go through the adjustColumnSize function.
I find this code which is responsible to set column width.
z=z.childNodes[cInd].textContent.length*6;
here I find that z.childNodes[cInd].textContent return nothing for cell having image tag.
If somehow I get complete cell data (including image tag) from z.childNodes[cInd] , will solve issue.
If somehow I get complete cell data (including image tag) from z.childNodes[cInd] , will solve issue.
The text content returns only text representation of cell, you can get its full content as HTML, but it will not give you the real size, because in FF you can get only size of visible area, not full size
You can try to add some complex rule, similar to next
if (z.childNodes[cInd].firstChild && z.childNodes[cInd].firstChild.tagName==“IMG”) //image as first child
z=z.childNodes[cInd].firstChild.offsetWidth;