I recently lived through one of Sherlock Holmes famous quotes in development land the other day.
when you have eliminated the impossible, whatever remains, however improbable, must be the truth
It was a serious bug in a recent Adobe Flex project that was something so simple (appearing) but could not for the life of me find out why it was occurring. I mean, I would not be releasing the software without this guy being fixed, it was a blocking issue.
Now I am far from an ActionScript junky that has been drinking the cool-aide since 2000 (yes AS is 10 years old, they grow up so quick). Anyhow…
So the issue at hand was pretty straight forward: A AdvancedDataGrid on portion of a panel that had numerous columns, some with ItemRenders some without. Not much data (still in a testing phase) and one huge bug:
DataGrid ALWAYS had the last row selected as soon as the grid gained focus.
You could interact with the grid and even ItemRenders that had sub-components reacted properly, but no row highlighting would ever move. ALWAYS that last row of data was highlighted.
So normal debug started to occur thinking some of the new “gee whiz” features I recently tacked on to the grid, was the cause (this is when version control saves you a zillion hours).
So I start rolling back to previous versions to go and find where the grid was acting like it should.
- Previous version, nope, OK, a little further back…
- Previous version, nope. jump further back….
- Dang this bug has been here since the beginning of time it seems. Boy that is a bad UI oversight.
- Where is the QA team!? I demand the QA guys head… oh that would be me. Dang, shut up, move on.
At this point I am thinking I have bad builds, bad development environment, start looking at other DataGrid’s in other projects (that are working and build fine). Making the whole thing much more worse and I think I have a huge underlying flaw somewhere. Not really, but we will get there. This is when a sane developer becomes an insane one. This is when the alchemy comes in and you start thinking the lead will always stay lead and there really is no gold at the end of the rainbow. This is when a true coder at heart thinks they hear the code weeping. But alas, we have a P that needs solving.
So I start ripping out the guts. I mean everything, code that have nothing to do with the problem is tossed aside, just to see if it magically gets fixed. Nope, nope and still nope. So it was time to step back.
Deep breath, OK, this is NOT UI code issues at play here. We have removed 99% of and it is still broken! Hmmmm. (I hear off in the distant, “when you have eliminated the impossible”)
So what was left? Not the UI, the source of the data? How could that be impacting what row was highlighted? The data is showing up fine in the grid and interacting with the data objects even work. That can’t be it! Ah, but it does.
A single lonely property that Adobe uses to keep track of its objects that normally would have never been an issue was the culprit this time round. See, it turns out that the ArrayCollection of data object’s remotely retrieved had a single property in it that should of never been there in the first place (dang badly designed data objects).
So what was the property in the DO that could of caused all this: UID
DOH
It actually would not have been a problem if it had been uniquely populated, but it wasn’t. It was null.
DOH DOH
So basically when the grid tried to uniquely look at the data objects so it knew which one was highlighted, they all looked the same since all the uid properties where all null.
Lesson learned and I swear those poor uid’s will never be overlooked and looked down upon ever again. Of course in this happy ending of story, the damn UID was ripped out and thrown against the wall and post haste the DataGrid selection and highlighting was once again working exactly as it should.
– THE END –
Tags: Adobe, DataGrid, development, Flex, SelectedItem, software, UID, web



Entries (RSS)