1. #1
    Ext User
    Join Date
    Nov 2007
    Posts
    8
    Vote Rating
    0
    timblack1 is on a distinguished road

      0  

    Question TreeGrid displays column headers but not rows

    TreeGrid displays column headers but not rows


    My TreeGrid here is displaying column headers but not rows. It also displays a vertical scrollbar. I can't figure out what is wrong with it--my best guess is that the JSON is not formatted correctly. What do I need to do to get this working?
    Last edited by timblack1; 3 Mar 2010 at 12:06 AM. Reason: Changed icon to question mark

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    IIRC, you need to configure it with a Store like a grid.

  3. #3
    Ext User
    Join Date
    Nov 2007
    Posts
    8
    Vote Rating
    0
    timblack1 is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    IIRC, you need to configure it with a Store like a grid.
    Doesn't the TreeLoader in TreeGridLoader.js create its own store? I think that's why lines 35-39 of TreeGrid.js read:

    Code:
                l = new Ext.ux.tree.TreeGridLoader({
                    dataUrl: this.dataUrl,
                    requestMethod: this.requestMethod,
                    store: this.store
                });

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    How does that create a Store?

  5. #5
    Ext User
    Join Date
    Feb 2010
    Location
    London, UK
    Posts
    4
    Vote Rating
    0
    wzylinski is on a distinguished road

      0  

    Default


    I had the same problem and it looks like you have to set the columns' width (you will also see your records if you resize the 1st column)

  6. #6
    Sencha User
    Join Date
    Feb 2009
    Posts
    8
    Vote Rating
    0
    rastafarra is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    IIRC, you need to configure it with a Store like a grid.
    i didn't see store in the sample (http://www.extjs.com/deploy/dev/exam.../treegrid.html).

    can you show another example?

  7. #7
    Ext User
    Join Date
    Nov 2007
    Posts
    8
    Vote Rating
    0
    timblack1 is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    How does that create a Store?
    Thank you for your help! I don't know how it creates a store, nor am I sure it does, though I think somehow simply setting the dataUrl config option in the Ext.ux.tree.TreeGrid in tree-grid.js creates the store, using the TreeLoader, because the (unmodified) example here displays rows even though it doesn't explicitly create a store, and my treegrid is an only slightly modified copy of that example. I tried explicitly creating a store as a config option in tree-grid.js, but haven't gotten that to work yet.
    Last edited by timblack1; 3 Mar 2010 at 8:29 AM. Reason: Fixed typo

  8. #8
    Ext User
    Join Date
    Feb 2010
    Location
    London, UK
    Posts
    4
    Vote Rating
    0
    wzylinski is on a distinguished road

      0  

    Default


    Mate, you don't need a store. The only reason you can't see your tree is because you didn't set the columns' width... Do it and it will display correctly. You can also see that it works fine if you try to resize the first column in your grid, like I did:
    Attached Images

  9. #9
    Ext User
    Join Date
    Nov 2007
    Posts
    8
    Vote Rating
    0
    timblack1 is on a distinguished road

      0  

    Default


    Quote Originally Posted by wzylinski View Post
    I had the same problem and it looks like you have to set the columns' width (you will also see your records if you resize the 1st column)
    Excellent! Thank you, that worked. I took the column widths out in the hope the TreeGrid's columns would automatically resize to fit their contents--is it still possible to get them to do that?

    I'm trying to understand the updateColumnWidths code in TreeGrid.js to see whether it requires hard-coded widths in the initial config, and that research is what kept me from replying to you more quickly.

  10. #10
    Ext User
    Join Date
    Feb 2010
    Location
    London, UK
    Posts
    4
    Vote Rating
    0
    wzylinski is on a distinguished road

      0  

    Default


    I was trying to make the columns auto expand with no success, so let me know if you manage to do it. Also, if you hide the column it will only hide it from rows, but not from the header