7 Replies Latest reply on May 23, 2008 7:21 AM by jumperB

    <cfgrid> driving me crazy

      Does anyone know how to reliably format dates in an html cfgrid? I've attached the code I'm using. I need to format the dateadded field in a european dateformat. the moment all I get is the native SQL date format, I won't be able to use cfgrid unless I can sort this out so any help would be most appreciated. I'm kinda pulling my hair out here. I've googled the problem and tried various scripting ideas but nothing works :-( This seems like such a basic thing I'm suprised there's no easy solution.

        • 1. Re: <cfgrid> driving me crazy
          See the docs - http://www.cfquickdocs.com/#cfgridcolumn

          Try using the type attribute - (type="date") along with a mask attribute (mask="DD/MM/YYYY") that should get you going.
          • 2. Re: <cfgrid> driving me crazy
            Level 7
            you can also use your db's date functions to format your date column as
            you need in your query...

            Azadi Saryev
            • 3. Re: <cfgrid> driving me crazy
              jumperB Level 1
              Thanks, I tried that one but it only seems to work when the form is flash. One of the requirements of this project is no flash anywhere so that one is out. I don't understand why the "mask" attribute doesn't work in html format grids but that is probably down to the integration with EXT. The more I look at it the more it feels like this component of CF is half-finished.
              • 4. Re: <cfgrid> driving me crazy
                jumperB Level 1
                Thanks for all your help guys but I've decided to try a different solution. cfgrid is obviously not designed to do what I want to do with it and trying to make it look the way I want is proving impossible. Things like default underlining of linked rows and other limitations including the date formatting mean that I am wasting way too much time on this. I gave the client timescales based on an initial assesment of the tag. Unfortunately that assesment didn't try to push too many boundries and the actual capabilities of the tag are rather pitiful. I don't have time to start hacking loads of css and javascript. I'm hoping adobe will improve the tag because at the moment it's pretty useless. Any cf tag you need to hack to make it do what you want is, in my opinion, incomplete and should not be included in a production release of Cold Fusion.
                • 5. Re: <cfgrid> driving me crazy
                  Level 7
                  not meaning to sound rude or anything, but... it's easy t blame the
                  tools when skills are lacking...

                  without defining your own css, all your pages will have the [ugly]
                  default looks defined by the browser rendering them.

                  same with the cfgrid - if you want it to look different, you have to
                  define your own style for it to change the default styles.

                  as for the date: the grid displays the date as your query returns it -
                  if you want to show the date in a specific format, then make sure your
                  query returns it in that format. super easy with sql date functions.

                  many of the new cf ajax features are still lacking in one way or the
                  other, no doubt. there are still bugs. it is up t you to decide if you
                  want to use the new features or not. you can always use the libraries
                  those features are based on instead - still does not mean they will do
                  exactly what you ant the way you want, because they are, just the same,
                  based on certain 'defaults' and, just the same, they have bugs as well.

                  you should have tested the functionality of the new features to make
                  sure it is acceptable for the project at hand, before giving the client
                  any timeframes, especially since, obviously, you have not worked with
                  them before. clearly some wrong assumptions on your part.

                  again, i do not mean to sound rude at all.

                  Azadi Saryev
                  • 6. Re: <cfgrid> driving me crazy
                    jumperB Level 1
                    I managed to resolve the issue with dates, that one proved quite easy in the end. The problem with the underline is much more difficult to resolve. I am perfectly capable of using firebug to determine what classes I need to rewrite and to construct the necessary CSS to rewrite them but it just doesn't work. I've looked through all the ext-all.css and ext-all.js and any other file I can find that relates to the grid but nowhere can I find the code that is putting "text-decoration: underline" into the div class for the rows. Skills are not the issue here, obfuscated code is.
                    • 7. Re: <cfgrid> driving me crazy
                      jumperB Level 1
                      From what I can tell it's the CF server that is putting in the text-decoration it's definitely not Ext or any CSS that is being called, even when I output the grid data with html wrappers to format the text it will make things bold, that's easy. I can also add an overline in text-decoration and it puts in underline AND overline. When I simply use text-decoration:none I still get the underline. Looking at the source of the rendered html I see the offending text-decoration in the script generated by the CF server but I have no control over it at all. The only thing I can do is remove the href and hrefkey parts of cfgridcolum and output my data as a new div embedded in the output which calls a javascript function to open the hyperlink, that way the entire row is still clickable. As I said before, this component in cf needs a lot more work before it is really fit for purpose.