I am having a lot of trouble with my column/column header alignment.
Image of the jqgrid:
As you can in the image above, my first column has a greater width than the column header. If i set the column header width to a larger number the column cells width grows as well. I have been trying things like turning shrinkToFit on and off and adding a class to the first column cells and setting 'max-widht' and 'width' but did not work.
The jqgrid is supposed to have a first column filled with employees names and the rest of the columns represent the days of the month. Days of the month will be either filled with a couple of letters and have their background coloured, or left empty.
Here is my code
$(document).ready(function () {
$("#tabs").tabs();
var ColModel1 = [];
ColModel1.push({ name: 'EMPLEADOS', label:'Empleados', index: 'EMPLEADOS', align:'left', width:185 });
for (var i = 1; i < 32; i++) {
ColModel1.push({ name: 'DIA_' + i, label: i, index: 'DIA_' + i, align: 'left', width: 27
});
}
ConstruyeGridVacaciones(ColModel1);
});
function ConstruyeGridVacaciones(ColModel1) {
$("#GridMaestroVacaciones").jqGrid({
datatype: 'local',
altRows: true,
altclass: 'jqgrid-altrow',
rowNum: 1000,
//scrollOffset: 0,
shrinkToFit: false,
height: 645,
hidegrid: false,
caption: "Vacaciones",
width: 1180,
colModel: ColModel1,
pager: '#PaginadorGridMaestroMonedas',
imgpath: '../shared/themes/basic/images',
viewrecords: true,
sortorder: 'asc',
});
var datos = {'EMPLEADOS':'1'};
for (var i = 1; i < 32; i++) {
var key ='DIA_'+i;
datos[key] = i;
}
$('#GridMaestroVacaciones').jqGrid('addRowData', '1', datos, 'last');
$('#GridMaestroVacaciones').jqGrid('addRowData', '2', datos, 'last');
$('#GridMaestroVacaciones').jqGrid('addRowData', '3', datos, 'last');
$('#GridMaestroVacaciones').jqGrid('addRowData', '4', datos, 'last');
$(".jqgrow td").first().addClass("ancho");
}