So, I'm building a simple data viewer for a client. It uses a set of filter fields on top. A grid in the middle. At the bottom is a simple form that gets populated when a user clicks on a grid item.
So - this is pretty cool. I love how it looks and how it reduces the amount of clicks the user has to do.
While building it, however, I ran into an issue. CFGRIDCOLUMN supports a currency type. It will correctly sort the values. However, for me, the values were not sorting. The data was coming from MySQL and I noticed that a few rows had slightly wierd values. There were still numerical, but looked like so: 10.01000000233. That should still work of course. I reported the issue to Macromedia. In the mean time, I used this as a fix:
select *, cast(amount as VARCHAR) as newamount
from getDonations
</cfquery>
Archived Comments
Another problem I’ve run into with cfgrid is with the cfgridcolumn type Boolean. It has a default of true(checked), but if a new row is inserted then submitted without the checkbox being rechecked it submits that value as [empty] instead of True
Ray,
Are you storing the values as floats in the DB? That could explain the odd looking results. That doesn't explain why they're not being formatted properly though :)
Ray,
I've been doing extensive work with CFgrid. Unfortunately, the flash version of CFgrid is quite broken. (That’s not to say unusable, but requiring a large number of work-arounds.) I there are numerous issues with the data being sent correctly on post. This is particularly prevalent when allowing your users to delete and add rows.
I created a form where a set of data was listed in a flash cfgrid. The user could select rows to edit them using bound text controls or delete them. They could also add new rows.
Now, image that you have a table populated with two rows. Your users comes to the form and deletes both rows and adds two new rows. The data that is received on post does not correctly represent the changes to the form state. I’ve also had problems with “phantom” rows appearing on submit or sorting. (I think this is related to how the cfgridrow column is numbered.)
Oh, another fun one is that your users can delete more rows than exist. Try having 3 rows in a grid and buttons for adding/deleting rows. Click delete 8 times. You have to then click add 6 times before you will see another row show up in your table.
Other fun issues…. Let’s see, if you have a column of type Boolean, but the column is not visible, the checkbox still shows up.
If you have a text box or textarea bound to a selected row in a CFgrid, even if the cell is empty you will have a space in your text area. Also, if your users delete all the rows from the table your will have the text ‘undefined’ show up in the bound text box.
Those are all the issues I can think of at the moment. :)
"there are numerous issues with the data being sent correctly on post." -- should read that the data is incorrect ;)
Doug,
were these issues with the beta or the final release. The first issue you mentioned about the submitted data from grid not being right sounds like a bug we had in beta.
Can you email me directly, I want to make sure I know about all the issues you've found. This way I can make sure they are all submitted as bugs so we can get them fixed. I haven't heard of some of the issues you mentioned.
thanks,
---nimer
mnimer@macromedia.com
Ray, make sure you are using a DECIMAL(x,2) data type for currency, instead of FLOAT OR DOUBLE. One of those MySQL workarounds.
-Brett
brett@clearrocksolutions.com
I found another weirdness, if you have a column of type 'image', it will render the picture well first, then if you scroll the image out and come back it has disapeared ;)
I have seen this bug before in flash, it was fixed by adding &lt;p&gt; around the image tag.
Does anybody know how to have the datagrid displaying more than one line of text per row, if you change the rowHeight attribute, it won't do it.
I found the way to do it for the Tree:
myTree.variableRowHeight=true;
myTree.wordWrap=true;
but this code doesn't apply to the datagrid (cfgrid)
Cheers
Another thing that is bothering me, is the fact that you CAN insert a new line in the datagrid by doing, GridData.insertRow(myGrid);. But it doesn't give you any option to insert a new line WITH specific data. I've been searching in AS and Flex docs a few nights, but I can't get it work properly :-S.
The Flash Forms is nice, but just not really feature finished if you ask me.
Just my 0.02 about cfgrid/flash forms.
Michael,
There is no way to insert data when you insert the row, but you can do it right after. with this
mygrid.dataProvider.editField(mygrid.selectedIndex, 'state', 'my new text');
hth,
---nimer
Another issue:
If you insert a CFGRID in a CFFORM, posting the form with a row selected will produce a param called GRID.CFGRIDROWINDEX with the selectedIndex number + all the columns values for the selected row.
I noticed that it doesn't work if you don't have an ONCHANGE attribute for CFGRID, if you dump the form, all values (GRID.CFGRIDROWINDEX ..) will be empty arrays :((
Juste adding onChange="" in the CFGRID works fine ;))
Cheers
Philippe
thanks for the myTree.wordWrap=true; hint - works great in cfgrid as well. you're a lifesaver!
Hey, good news, looks like the CFMX 7.01 updater fixes some (if not all - heck i just downloaded it heehee) issues with some CFGrid processing - at least the checkboxes come up empty when initially inserting a row.
Thanks Nimer :)
Doug said: 'there are numerous issues with the data being sent correctly on post. -- should read that the data is incorrect ;)'
Doug, and All,
I developed a CF custom tag to parse through the flash form grid post results, and pick out what was really 'edited' using the checked method that asfusion prescribes. Essentially, you get a list back of the primary keys of the rows that were truly checked versus 'edited'.
Sami
Hi!
I am having an issue with sorting the CFGRID. It only happens when I set the type attribute specifically and also when the data set in the grid is a bit large e.g. 1800 rows. I have a zip code field that I set to numeric however when I sort the field it works fine the first time but the next time I try to sort it it makes the flash player hang up. It always happens on the second attempt. It pops up a warning message saying that a script in the movie is making it run slow and asks me if I want to kill the script. When I kill it I can not reuse the form without reloading it. If I remove the type attribute I can sort without any problems. My guess is that it has something to do with flash doing some type conversions before sorting.
Does anyone know of any workarounds to make the grid recognize and sort a number correctly. Btw I am populating the grid via flash remoting.
Thanks a heap in advance !
Harkirat
P.S. I am using CF MX 7.0.2
hi, please can you kindly assist me, i am trying to mask the date using CfGrid and its not working, its displaying the default format eg 2008-05-01 00:00:00.0
Below is my code:
<cfform action="test.cfm" method="post">
<cfgrid name="listMyContracts" width="100%" align="value" appendKey="yes" bgColor="white" autoWidth="no" colHeaders="yes" colHeaderTextColor="black" delete="no" query="listContracts">
<cfgridcolumn name = "commencementDate" header = "Commencement Date" width="182" mask="yyyy/mm/dd">
</cfgrid>
</cfform>
Mask is only valid with the Flash Form version of the grid.
how can I update a cfgridcolumn type boolean?