Build 20100207 fixes alignment of header's and table cell's width of CoolGridView
41 Comments Published by John Eric Sobrepena on Feb 7, 2010
A new build release (Build 20100207) of CoolControls is now available at codeplex. Build 20100207 contains the following changes:
- COLGROUP and COL is back! These are generated for the header, table content and footer. This feature can align the header and table cell's width of CoolGridView.
- AllowResizeColumn property is added to CoolGridView. Set this property to true to enable user to resize the columnns manually, set it to false to disable. The default value of this property if true.
Labels: ASP.NET 2.0, CoolControls, CoolGridView, GridView
The newest release of CoolGridView is available for download. There are a handful enhancements, optimizations and bug fixes in this release. Here are the ones worth mentioning.
DefaultColumnWidth Property
You can now define the default column width of CoolGridView columns through the DefaultColumnWidth property. The value for this property can not be of type UnitType.Percentage. On older releases of CoolControls, if a HeaderStyle-Width is not defined for a data column, it defaults to 100px. This value is hard coded inside the control. Now you can specify your own default column width. I got a lot of requests to allow column and table widths to be specified in percentage. Allowing column or table widths to be in percentage and at the same time making sure that the column widths can still be resized by the properly is a great challenge. However, rest assured that I am not dropping this request and that the development of this functionality is still being considered.
SPAN inside Table Cell
There was a bug in CoolGridView when displayed in IE 6 and 7. It was reported by developers that it seems that the style "white-space:nowrap" does not behave properly when applied to TD and TH element when the "width" is also defined in the style. Consider the following code:
"Gradient" Theme
There is a theme included in the sample project in this release that gives a 3D look on the table headers. In this theme, the white spaces inside the cell is not set to wrapped. When user resizes the column width and if text does not fit inside the cell, ellipsis will appear at the end of the text to indicate that there are portion of the text that is hidden.
To use this theme, you have to copy the "Gradient" folder into your "App_Themes" directory and copy the headerbg.gif file into your website in the location "\images\". Set EnableTheming to "True" for your ASPX page and set the Theme property to "Gradient".
COLGROUP and COL Elements Removed
Older releases of CoolGridView generates COLGROUP and COL html tags to control the column widths. However, the control does not render properly in the browser if the entire cells for a column is hidden using the style "display: none". Therefore, COLGROUP and COL were removed.
For more information of what are the other changes, you can read the release notes included in the latest build.
Have a great week everyone!
DefaultColumnWidth Property
You can now define the default column width of CoolGridView columns through the DefaultColumnWidth property. The value for this property can not be of type UnitType.Percentage. On older releases of CoolControls, if a HeaderStyle-Width is not defined for a data column, it defaults to 100px. This value is hard coded inside the control. Now you can specify your own default column width. I got a lot of requests to allow column and table widths to be specified in percentage. Allowing column or table widths to be in percentage and at the same time making sure that the column widths can still be resized by the properly is a great challenge. However, rest assured that I am not dropping this request and that the development of this functionality is still being considered.
SPAN inside Table Cell
There was a bug in CoolGridView when displayed in IE 6 and 7. It was reported by developers that it seems that the style "white-space:nowrap" does not behave properly when applied to TD and TH element when the "width" is also defined in the style. Consider the following code:
<table style="table-layout:fixed;width:90px" border="1"> <tr> <td style="white-space:nowrap; width:30px; overflow:hidden;">Test inside the cell.</td> <td style="white-space:nowrap; width:30px; overflow:hidden;">Test inside the cell.</td> <td style="white-space:nowrap; width:30px; overflow:hidden;">Test inside the cell.</td> </tr> </table>If you view the code above in IE 6 or 7, you will see that the text inside the cell wraps and breaks on white spaces even though the style was set not to wrap on white spaces. The fix for this is to put a SPAN that encloses the text inside the cell and put the style "white-space:nowrap" on the SPAN instead of the TD. The code below now works properly in IE 6 or 7. CoolGridView uses something similar to this but uses CSS instead.
<table style="table-layout:fixed;width:90px" border="1"> <tr> <td style="width:30px; overflow:hidden;"><span style="white-space:nowrap;">Test inside the cell.</span></td> <td style="width:30px; overflow:hidden;"><span style="white-space:nowrap;">Test inside the cell.</span></td> <td style="width:30px; overflow:hidden;"><span style="white-space:nowrap;">Test inside the cell.</span></td> </tr> </table>
"Gradient" Theme
There is a theme included in the sample project in this release that gives a 3D look on the table headers. In this theme, the white spaces inside the cell is not set to wrapped. When user resizes the column width and if text does not fit inside the cell, ellipsis will appear at the end of the text to indicate that there are portion of the text that is hidden.
To use this theme, you have to copy the "Gradient" folder into your "App_Themes" directory and copy the headerbg.gif file into your website in the location "\images\". Set EnableTheming to "True" for your ASPX page and set the Theme property to "Gradient".
COLGROUP and COL Elements Removed
Older releases of CoolGridView generates COLGROUP and COL html tags to control the column widths. However, the control does not render properly in the browser if the entire cells for a column is hidden using the style "display: none". Therefore, COLGROUP and COL were removed.
For more information of what are the other changes, you can read the release notes included in the latest build.
Have a great week everyone!
Labels: ASP.NET, COL, COLGROUP, CoolControls, CoolGridView, DefaultColumnWidth, GridView, IdeaSparks, IdeaSparx, Theme