Hi!
I would like to figure out if there is a clever way to “stretch” all columns of a grid to fit all the available width of the layout window (as in setInitWidthsP) but AFTER some columns have been hidden?
Thanks & Cheers
Pavol
Unfortunately the setInitWidthsP() uses the the width in perscentages from the whole width of the grid’s container.
You may try to add “*” in the width of one of the columns or resize the columns after the hiding the column.
Hi sematik,
Thanks for your answer!
I tried to resize the size of the visible columns and found out something inconsistent in relation to the DHTMLX doku: The command “setColWidth()” should resize a column to a certain pixel value, not to a percentage. However using this code:
width=(main_layout.cells('a').getWidth()); //width=1501
var visCnt = 0;
var visList = new Array();
for (var i=0; i<grid.getColumnsNum(); i++){
if(!grid.isColumnHidden(i))
{
visCnt++;
visList.push(i);
}
}
colSize=width/visCnt; // visCnt=19, ColSize=100.12
for (var i=0; i<visList.length; i++){
grid.setColWidth(visList[i],colSize.toString()); //works with both, string or int
}
each column gets stretched to 100% of the screen width instead to 100 pixels
(dividing by 100 also doesnt solve my problem completely because the function setColWidth takes in an integer as the parameter, so I cant scale the cols precisely to the screen width)
Cheers
Pavol
Unfortunately the issue cannot be reconstructed.
Your code works well for us.
If issue still occurs - please, provide a more detailed sample of your code.