Flex TreeGrid

For a while I have been wanting to create a TreeGrid component for Flex. The
basic idea is to allow a user to navigate a Tree like object within a
DataGrid. Well, I just finished a very hacky version 1:
Here are some problems with the current implementation:

  • I get strange flicker when mousing over the cells. Don’t know why.
  • If I resize the right column to cover part of the Title, the title doesn’t get clipped. Don’t know why.
  • The code looks only for children named “product”. I don’t know of a way to make this generic / configurable.
  • Only supports 3 levels because I can’t figure out how to do recursion in the disclosurePress function. When I tried to call another function to do recursion the recursive method never got called. Don’t know why.

Other than all that, it works decently. :) Any ActionScript experts out there, please help me out. :)

Here is the mxml code
Here is the cellRenderer code

Enjoy!

-James

This entry was posted in RIA. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

13 Comments

  1. Jose Lora
    Posted February 27, 2005 at 6:36 am | Permalink

    You may want to disable sorting on the columns.

  2. Matt
    Posted March 2, 2005 at 4:55 am | Permalink

    setValue is creating too many objects. Every time it is called it is creating the disclosure icon and the label when in reality it should only create those once and then subsequently change those properties as appropriate. There is probably a memory leak as the old versions aren’t being destroyed and the flicker is because you’re seeing the new objects get created (you’ll notice that the normal cells on the right don’t flicker). setValue gets called a ton (every time the mouse enters and exits) so it needs to be more efficient.

  3. latha
    Posted September 28, 2006 at 7:36 pm | Permalink

    Hi,

    I was finally able to convert the treeGrid code from flex 1.5 to flex 2.0 !

    Thanks to your code, it wasn’t as daunting a task as i had imagined. :)

  4. Posted October 10, 2006 at 11:24 pm | Permalink

    Latha has managed to port your treeGrid code from flex 1.5 to 2.0…. Here’s the link -

    http://codercentral.blogspot.com/2006/10/using-treegrid-in-flex-20.html

  5. Posted October 31, 2006 at 6:59 pm | Permalink

    I can not open the follow link:
    http://codercentral.blogspot.com/2006/10/using-treegrid-in-flex-20.html
    Any one help~

  6. Posted February 8, 2007 at 12:56 am | Permalink

    The link is working fine for me. Check it out once again. :)

  7. Anonymous
    Posted February 20, 2007 at 5:03 am | Permalink

    As soon as I set sortableColumns to true and start sorting, data gets lost and the data left is messy.

  8. James Ward
    Posted February 20, 2007 at 11:38 am | Permalink

    Sorry sorting isn’t supported in this component.

  9. Posted March 29, 2007 at 8:50 am | Permalink

    Hi James,

    I found your treeGrid component a few days ago and it was all what i need !
    I use the version for flex 2 updated by Latha.

    But I found a little bug in the ‘openItem’ function.
    When you open items until 3rd level, then close first level and open it again the sublevels arn’t displayed properly.

    Here’s the ‘openItem’ function corrected :
    http://www.y-dow.info/treeGrid_openItem.txt

    Thanks for your work.

  10. mckang
    Posted May 24, 2007 at 5:33 pm | Permalink

    when I resized treegrid hearder, appear scroll in each cell
    I want to disapper this scroll in cell treegrid

    please !!

  11. Michal
    Posted June 7, 2007 at 6:11 am | Permalink

    Hello James,

    as McKang wrote, it is possible to remove that horizontal scrollbar which appears in column when the column width is smaller as width of the text?? It is indeed unusable, because you don’t see anything, except that srollbar:)) thanks Michal

  12. Michal
    Posted June 7, 2007 at 6:35 am | Permalink

    Hi,

    forget this:) I’ve found the solution. It is simple. In MyTreeGridRenderer class add attribute horizontalScrollPolicy=”off” in canvas section. That’s it…:-)

  13. Michal
    Posted June 7, 2007 at 6:54 am | Permalink

    But I have another question. Does somebody know how to do it, that by clinking on a button, will be all rows (levels) expanded and reversal??? thx

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Subscribe without commenting

  • About James Ward



    View James Ward's profile on LinkedIn

  • First Steps in Flex by James Ward and Bruce Eckel




  • Twitter Updates


  • Tour de Flex