Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prasad on Dec 03, 2007 09:51
open dhtmlx forum
Adjusting Column Size

Hi,

I want to adjust the all column to there maximize text size. Say by clicking on expand All button.
I used this function. It works, but also unneccesarily increses other columns width.
What is the Problem?

function expandAll(){
for(var expandCol=0;expandCol<mygrid.getColumnCount();expandCol++){
mygrid.adjustColumnSize(expandCol);
}
}
Answer posted on Dec 04, 2007 02:43
Actually there must not be problem, but adjustColumnSize functionality has known limitation - in FF it is impossible to detect the real size of text inside cells ( it process table cells in specific way ) so instead of  DOM data, some rough calculations done instead
   
dhtmlxgrid.js , line 5046

    z=z.childNodes[cInd].textContent.length*7;

this works pretty fine for default font sizes, but if you smaller font sizes it need to be adjusted.