How to set width of headers

Hi,

I’m using dhtmlx Grid on a rails app. I’m having issues with the width of the headers.

Here’s my code:

[code]
var grid = new dhtmlXGridObject(“grid_here”);
grid.setImagePath(“…/assets/dhtmlx/imgs/”);
grid.setHeader(“PatientID, U.Sanitaria, Provincia, Data Ent. Lab, Data Proc. Lab, Cod. Lab, Resultado, Estado Positivo, Motivo Rejeição, Aprovar, Data Aprovação, Status, Env. Res., Observações, Comentários”);
grid.attachHeader(“#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter”);
grid.setColTypes(“ed,ed,ed,ed,ed,ed,ed,ed,ed,ch,ed,ro,ed,txt,txt”);
grid.setColSorting(“str,str,str,date,date,str,str,str,str,str,date, str,str,na,na”);
grid.setInitWidths(“30,100,*”);
//grid.enableAutoWidth();
grid.setSkin(“dhx_skyblue”);
grid.init();
grid.load(“/approves/data”);
grid.attachEvent(“onCheck”,doOnCheckBoxSelected);

		dp = new dataProcessor("/approves/dbaction.xml");
		dp.init(grid);
		
		function doOnCheckBoxSelected(rID, cInd, state)
		{
			if (state=='1')
				{
					grid.cells(rID, 11).setValue("Definitivo");	
					var now = new Date();
					now.format("yyyy/mm/dd");
					grid.cells(rID, 10).setValue(now);
					dp.setUpdated(rID, true);
				}
			else
			{
				grid.cells(rID, 11).setValue("Aprovacao Pendente");
				grid.cells(rID, 10).setValue("");
				dp.setUpdated(rID, true);
			}

		}
    </script>[/code]

Here’s a screenshot.

Any idea on how to solve this issue? I’m willing to have horizontal scroll.


in the
grid.setInitWidths(“30,100,");
with should be set for each column of your grid, but only for some columns:
grid.setInitWidths("30,100,
,,,,…”); // a single value for each of your 15 columns

Thanks for your answer. I fixed the size of the headers as you can see below:

grid.setInitWidths("60,80,60,80,88,60,90,120,100,55,70,120,70,100,100");

But I still get the problem in the grid.setColSorting, as you can see in the picture attached. Is it possible to set this width? As you can see in the picture (i’ve marked two examples, but it happens in all collumns) they don’t “end” up properly, aren’t they supposed to be “attached” to the header size?


Unfortunately the issue cannot be reproduced locally.
Here is the screenshot of the following settings:
mygrid.setInitWidths(“60,60,60,80,80,80”)

The same one, but with
mygrid.setInitWidths(“60,50,40,30,20,10”)


Please, try to update the version of your grid.
If issue still occurs for you - pleas,e provide with a complete demo, where the it can be reproduced.