ColdFusion Community

The online ColdFusion / CFML community website

Gareth Arch

Datagrid error? I'm not even using a datagrid! Troubleshooting in Flex.

It's a good job I like how easy it is to build Flex apps, because some of the errors I get (and the time involved in trying to find the problem and fix them) would probably drive me to smash it a few times over.

OK, the latest error I managed to throw in my application:

I had written a user management page to allow the end user to manage profiles for all of their users. I first built a list of all users (name, email) and put them in a datagrid. From here an admin would click "Add New" or select a user to edit. I then used a wipe effect to hide the datagrid, and the wipe effect to show the user edit form. I had built the whole page, and had been testing it out, and had just started to build my comboboxes. I had built both comboboxes using objects. The page loaded a little slowly (trying to load many objects into a combobox is not a good idea), so I switched to loading it from a query call. My first combobox worked fine, but when I tried to populate my second combobox the page started to throw this wonderful error:

ArgumentError: Error #2004: One of the parameters is invalid.
at flash.display::Graphics/drawRect()
at mx.controls::DataGrid/mx.controls:DataGrid::drawRowBackground()
at mx.controls::DataGrid/mx.controls:DataGrid::drawRowBackgrounds()
at mx.controls::DataGrid/mx.controls:DataGrid::updateDisplayList()
at mx.core::UIComponent/validateDisplayList()
at mx.managers::LayoutManager/::validateDisplayList()
at mx.managers::LayoutManager/::doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/::callLaterDispatcher2()
at mx.core::UIComponent/::callLaterDispatcher()


I was trying to figure out what a combobox had to do with a datagrid (other than them both having an attribute named "dataProvider"), and started my troubleshooting. I changed from calling specific dB columns to using "*" and that seemed to work (at least did not throw the error when the data was returned), but the columns were not named the way I wanted them to be so I tried renaming data columns (using "as"), and everything I could think of (completely removing the datagrid page and going directly to the form in case there was something strange happening in transition).

I then misnamed the function call to the function that would receive the data once it had been built in the database...no error...weirdness! I then figured it must be something on the display page. I removed the labelField from the combobox and lo-and-behold, no error again. I figured I'd try setting that value in actionscript...same error. Well, just removing that wasn't going to work out for me as I really need that display name. With frustration setting in, I figured I would remove just about everything from the page except that one combobox...*still* got the error. Argh!

At this point, I was ready to switch back to my objects, but not one for giving up, I then thought, "hey, let's remove the "pretty effects" (as that was about the only thing I *hadn't* removed), and what do you know, it worked correctly.

To make a long story longer, it appears that whatever Flex does when it wiped the page in, did not have enough time to calculate something that it needed in the combobox before populating it. However, the extra time that was taken in the round trip to the server to build the object for the combobox, was apparently enough time for Flex to get everything it needs to populate it. So this time, slow code actually worked (not efficiently but it somewhat prevented the problem).

I decided I like the wipe effects, so I'm just going to addEventListener for EffectEnd, *then* populate everything...hopefully that will get around the time discrepancies and cause me less of a headache.

Add a Comment

You need to be a member of ColdFusion Community to add comments!

Join ColdFusion Community

Specialists in ColdFusion Development
Tagged.com

> Place your advert here /h3>

Latest Activity

Sagar H Ganatra and Nikhil Saxena are now friends
13 hours ago
Nikhil Saxena and Chandan Kumar are now friends
14 hours ago
Sagar H Ganatra updated their profile photo
yesterday
Sagar H Ganatra has set up their private workspace using Huddle Workspaces.
yesterday
Sagar H Ganatra added 3 photos
yesterday
Bill Dempsey and Sagar H Ganatra joined ColdFusion Community
yesterday
on Monday
2 members updated their profile photos
on Monday
Sally Georgeson added 8 photos
on Sunday
Sally Georgeson added a video
on Sunday
Sally Georgeson updated their profile
on Sunday
Naveen Krishnamurthy, Sally Georgeson and John di Stefano joined ColdFusion Community
on Sunday

Members

  • Daniel Short
  • Frank Wreath
  • Kalyan Dhar
  • Celina William
  • Renu Deshpande
  • OWL76
  • Brian Massey
  • Sagar H Ganatra
  • Jinesh.k
  • Carol McKenzie-Harvey
  • Joe Danziger
  • Nico Knaepen

Translate this page

© 2010   Created by Nick Tong

Badges  |  Report an Issue  |  Terms of Service

Sign in to chat!