Stuff to click on

Thursday, December 21


This just seems dumb (geek alert)...

I am working on a big project at work. We are building a RIA using Adobe Flex Builder. Both my co-worker and I are learning Flex as we go, with a little training here and a lot of googling there.

We were having problems with combo boxes populating correctly. The data was coming back fine, and it seemed like things should have been working OK. But on a form with 3 combo boxes, only one would have the "currently selected" item, as populated from a database.

After changing the format, re-ordering the fields, and double and triple checking just about everything... a-HA!

When you fetch information from a database, Flex uses something called a RemoteObject. This connects to the code with the db queries and tells it what to do after the data is returned. In this case we are using RemoteObjects to connect to Coldfusion Components (CFC's) that contain multiple, uniquely named functions. You can add more than one function in a CFC to each RemoteObject.

I noticed that the order in which I fetched the list of items for the combo box was important. The first call resulted in a combo box with the proper value selected. The others just had the default value. I noted that all three were getting their data from the same RemoteObject.

BUT... apparently the system is limited to one instance of the RemoteObject at a time. Since the three combo boxes were being returned from the same RemoteObject we were having a latency problem. I divided the work between three RemoteObjects (one for each combo box) - and it worked.

Note, I pointed the individual RemoteObjects to the SAME back-end Coldfusion Component. So that file can be opened by multiple RemoteObjects at once, I guess.

Why is this dumb? Because now instead of one RemoteObject code block that references a CFC file... I have to have three that are almost identical. Clutter, clutter, clutter!

No comments: