I'm working width WedDataGrid 10.2 in Visual Studio 2008/Framework 3.5. When I set the width of each grid column in the designer, the column header for each column is rendered 1px narrower than the rest of the column. I've tried adding an additional pixel of padding but this did not work. After looking through the page source I found that for a 50px column, the width on the column header is set to 49px. Any help or workarounds would be appreciated.
Thanks!
Thanks, I wasted all day on this. Once I took the 100% off column width and used your code it worked:
var dataGridID;
function wdgTotals_Initialize(sender, args) {
dataGridID = sender.get_id()
var grid = $find(dataGridID)
syncHeaderFooterWidths(grid);
}
function syncHeaderFooterWidths(grid) {
var cols = grid.get_columns();
var colCount = cols.get_length();
var i;
if (grid._header != null) {
var headerCells = grid._header.getElementsByTagName("th");
if (headerCells != null) {
for (i = 0; i < colCount; i++) {
headerCells[i].style.width = cols.get_column(i).get_width();
if (grid._footer != null) {
var footerCells = grid._footer.getElementsByTagName("th");
if (footerCells != null) {
footerCells[i].style.width = cols.get_column(i).get_width();
In the Grid's Clientside Initialize event. Set the Grid's ClientEvents -> Initialize Property = wdgTotals_Initialize and include the javascript below in your page.
function wdgTotals_Initialize(sender, args) { syncHeaderFooterWidths(sender); }
Where are you calling this from?
For anyone who has this problem, here's what I did to get around it.
function syncHeaderFooterWidths(grid){ var cols = grid.get_columns(); var colCount = cols.get_length(); var i; if (grid._header != null) { var headerCells = grid._header.getElementsByTagName("th"); if (headerCells != null) { for (i = 0; i < colCount; i++) { headerCells[i].style.width = cols.get_column(i).get_width(); } } } if (grid._footer != null) { var footerCells = grid._footer.getElementsByTagName("th"); if (footerCells != null) { for (i = 0; i < colCount; i++) { footerCells[i].style.width = cols.get_column(i).get_width(); } } }}