Musings on AdvancedDataGrid (Part 4)

english mobile

So, in part 3, I gave up on my extension of the AdvancedDataGridItemRenderer altogether and set my extended AdvancedDataGridGroupItemRenderer as both the itemRenderer and groupItemRenderer on the AdvancedDataGrid. This gave me a nice uniform appearance on all of my itemRenderers. So I set off happily to write my iconFunction.

This turned out to work exactly as advertised, with only one hitch--my leaf icons weren't rendering. Had I misunderstood? Did the iconFunction (as opposed to groupIconFunction) work only for grouping rows? Well, no, as it turns out.

If you'll recall, way back in Part 2 I had a problem getting my styles to show up in my first column, so I set the itemRenderer on that column to my extended AdvancedDataGridItemRenderer. Even after I did this, though, some cells still didn't show my styles. At the time, I didn't understand what that meant.

Lesson Number 3: All itemRenderers in the tree column will use the specified groupItemRenderer, unless you specifically tell that column to use something else. Even if you do tell that column to use something else, it will still use the groupItemRenderer for (ahem) grouped items.

Once I figured that out, it was obvious to me that by removing the itemRenderer property on that column, I would then have 100% of cells using my extended AdvancedDataGridGroupItemRenderer, which had the existing icon functionality plus my added functionality for setting the background based on a style passed in through the styleFunction.

Great! Wonderful! But I then found that my particular data structure depended on knowing something about both the parent node and the child node in order to know what to do with an item click, and I couldn't figure out how to get the information about a strongly typed parent from a strongly typed child that might be the child of more than one parent.

Tomorrow, I will write about how I got this information.


Mr.Trickster said...

Thank you very much, Amy, you save my day.

Niko said...

I can't figure out how to change the icon for bottom level items(those that have no children).

Could you be so kind to ahre a solution?

moss said...

Would it be hard to make some data nodes not expandable? I'm having troubles tucking data into my xml tree that doesn't cause it to add another little expand node. I have a list of data that drives the display of one of my attributes. That list causes the node to have a little leaf icon and make it expandable.

Thanks! Wonderful blog. So generous of you to share your expertise.

Amy B said...

This is relatively easy to do on a Tree with a custom DataDescriptor. I think there's something similar with ADG, but I haven't played with it for a while and the mechanism isn't rising to the top ofmy mind at the momen.

CoDo said...

Hi Amy,

In part 2 the link "this method" errors:
Not Found
The requested URL /index.cfm/2006/10/3/BackgroundRowColor-DataGrid-component was not found on this server.

Cor van Dooren
The Netherlands

Amy B said...

Hm, I couldn't find that link in Part 2. Sorry, but links do get taken down on other sites sometimes.