One of the pains of using cfgrid is that the width has to be hard-coded in. As a developer, you can’t assume the user’s screen width, even if they are admins with directions/instructions. Fortunately, to get around this shortcoming is not too difficult.
CMS Welcome Page
In the ‘OnRequestStart’ function of application.cfc you’ll need this snippet. It checks to see if there is a session variable of ‘bodyWidth’. If not, it looks for the cookie. If no cookie, default to 1067. Of course you can set that default to whatever you’d like.
<!--- GRID WIDTHS ---> <cfif not isDefined("session.bodyWidth")> <cfif isDefined("cookie.bodyWidth")> <cfset session.bodyWidth = cookie.bodyWidth> <cfelse> <cfset session.bodyWidth = 1067> </cfif> </cfif>
Template with cfGrid
Now the easy part. In your cfGrid tag simply use the width stored in session.
... width="#session.bodyWidth#" ...