Tree columns autofit in Tree

Hello Everyone,
        I need to adjust my columns in a tree such that, all the unused columns (which has empty header strings and they are present only at the end) should be deleted and that, the columns should exactly fit my tree. How can I implement this?
Thanks,
Vasanth.
Ya Ya

I don't mean to barge in, but here's a little bit of code that will autosize the columns without resizing the whole table. Also, you can't really delete columns, hiding them is what you want. The actual value that you'll read from the tree is just the tag from the first column, so any subsequent columns will only display what you put in them.
Message Edited by Marc A on 01-05-2007 09:28 AM
Attachments:
autosizecols.PNG ‏5 KB

Similar Messages

  • Af:tree column in af:table

    I have af:tree as a column in an af:table and the expand/collapse functionality of af:tree behaves in a way that it works only on the last row added to the table and moreover while working on the last row it expands/collapses all trees in all other rows. All the other rows won't work at all.
    All rows have their own instance of TreeModel. Any clue why this happens ? Does anybody use af:tree as a column in a table ?
    JDev/ADF 10.1.3.3.0.4157
    Thanks for any help
    <af:table binding="#{bean.table}"
    value="#{bean.listTree}"
    banding="row" bandingInterval="1"
    var="row">
    <f:facet name="selection">
    <af:tableSelectMany binding="#{editor.component}"
    text=""
    shortDesc="Select">
    </af:tableSelectMany>
    </f:facet>
    <af:column id="treeLogCol" headerText="Tree" sortable="false">
    <af:tree id="treeLog"
    var="sel" value="#{row.testModel.model}"
    disclosureListener="#{bean.testDisclosureListener}"
    focusRowKey="#{row.testModel.model.focusRowKey}">
    <f:facet name="nodeStamp">
    <af:commandLink text="#{sel.label}" action="#{sel.getOutcome}"/>
    </f:facet>
    </af:tree>
    </af:column>
    </af:table>

    A workaround that seems to work fine is to define a disclosureListener as following -
    public void testDisclosureListener(DisclosureEvent disclosureEvent)
    CoreTree tree = (CoreTree)disclosureEvent.getComponent();
    TableRowWrapper row =
    (TableRowWrapper) ((UIXTable) _table).getRowData();
    PathSet set = tree.getTreeState();
    try
    set.setTreeModel(row.getTreeModel());
    catch(Exception e)
    if (disclosureEvent.isExpanded())
    set.add();
    else
    set.remove();
    // comment the following row since it will expand/collapse all trees in the column
    // AdfFacesContext.getCurrentInstance().addPartialTarget(_table);
    }

  • Tree column in AdvacedDataGrid component

    Hi,
    is it possible to define the column in which the tree is
    displayed? I need the tree in the second column. I always get the
    tree in the first column of the grid. This can't be so hard to
    change. I saw this feature in the treegrid implementation in
    "flexlib".
    Thanks!

    Hi,
    My xml data is a flat data. It looks like:
    <name>John Ross</name> <country>USA</country> <GroupID>1</GroupID>
    <name>Mary Down</name> <country>USA</country> <GroupID>1</GroupID>
    My AdvancedDatagrid uses GroupingCollection with GroupField is "GroupID".
    I don't know how to change tree column to column 2 or 3 instead of column 1.
    Thanks

  • Troubles when trying to transfer a table with hierarchical column to a tree

    In WD for ABAP, I encounter many troubles when trying to transfer a table with hierarchical column to an actual tree. In my UI, the tree is in the left pane and the detail for a node is in the right.
    1. With hierarchical table, I can bind the dataSource of the table directly to the context node in View which is mapped to a context node in component controller which is a DDIC structure. But with a tree, is it possible to map the dataSource of the tree or node in tree to context node in component controller?
    2. With hierarchical table, when lead selection changed, the detail info in the right pane will change automatically. But with a tree, it seems to have to be implemented via action by myself.
    Can anyone give some suggestions to overcome these troubles?

    Wei,
    <i>With tree table, the dataSource of the table is just bound to the context node ORG_UNIT</i>
    Hmmm... You said, that this node resides in component controller, not in view controller. Or does it?
    Any recursive node that can be displayed with tree table can be displayed with tree as well. Period.
    1. Create tree and bind data source to the same node as table data source.
    2. Create tree node type and bind it to the same node again.
    3. Create one additional calculated attribute in forementioned node (type boolean) that inverts/negates attribute for table column "hasChildren" to tree node "isLeaf".
    4. That's all.
    VS

  • How do I read text from specific rows and columns in a tree structure?

    How do I read text from specific rows and columns in a tree structure? In a table you can specify the cell to read from but I have not been able to figure out how to do this with a tree structure.

    You need to set two properties to activate the correct cell and then you can read it's string property.
    The positioning properties are the "ActiveItemTag" and
    "ActiveColNum" properties. With them you select the tree item by it's tag and the active column. The string can then be read from the "Cell String" property.
    MTO

  • Error When building ess/tra/tre and ess/tra/tre/trs DC's

    I had customized the ess/tra/tre and ess/tra/tre/trs DC's and had them working, but I do not know what I did or what happened that am now getting the following errors when building, can anyone help tell what the problem could be?
    Error                                     
    -     The project was not built since its classpath is incomplete. Cannot find the class file for com.sap.xss.tra.model.openccmodel.OVSOpenCostcenterModel. Fix the classpath then try rebuilding this project.               
    -     HDI_HNS15.02_Desstratresap.com                              
    Error                                     
    -     This compilation unit indirectly references the missing type com.sap.xss.tra.model.openccmodel.OVSOpenCostcenterModel (typically some required class file is referencing a type outside the classpath)        
    -      InternalVcTreReview.java          
    -      HDI_HNS15.02_Desstratresap.com/gen_wdp/packages/com/sap/xss/tra/tre/vc/review/wdp      
    -     line 0

    For anyone who might need to know, I managed to fix this by adding tra to the required projects on the build path. On the Navigator View, right click -> Properties -> Java Build Path -> Projects tab -> check dependant project.

  • How do I get text value in column next to tree element?

    I can only get elements from the left column...how do I read from other column.
    For example if I want  "Version 1.0" i get the section1 tag, then the first child...and then?
    thanks
    Attachments:
    get_tree_column_elements.JPG ‏17 KB

    Thank you
    in the mean time I came up with a similar solution.
    What is the difference between the property and invoke node I used and yours? Maybe my version is more flexible because require a generic tree reference? But yours looks more simple and clear...
    I'm not an expert of these functions I was just wondering about the theory beyond them and which is best in which case.
    diego
    Attachments:
    get tree attributes.JPG ‏55 KB
    tree example.JPG ‏21 KB

  • Average sum for a column in ALV tree layout

    Hi,
    I've trying to set an average sum for a column in an ALV tree report.  In the field catalog i set the DO_SUM field to 'X' and this will do a total sum, but I can't find out how in the code to do the average sum.
    Also to get round this I was going to just set a default display variant with the "average" sum option saved after i had manually selected the columns and set it to this.  Problem with this is that when i re-run it, the sum comes back as a total rather than an average.  I have tried setting display variants on the SAP example ALV tree programs and the same thing happens.
    Does anyone know how i can get round this?
    Cheers
    Matt.

    Hi,
    In addition to setting DO_SUM = 'X' you need to specify function in H_FTYPE field. It should be set to 'AVG' in your case.
    ls_fielcat-do_sum = 'X'.
    ls_fieldcat-h_ftype = 'AVG.

  • Re-sizing hierarchy column in ALV Tree

    Hi all,
    I have created a class inheriting from CL_GUI_ALV_TREE that is used to create a Tree structure for Equipment.....
    Now my requirement is that the Hierarchy column should be re-sized based on the width of the node text.
    Please help.
    Thanks in advance.....

    You can control the size of the hierarchy column by setting the following field:
    *Set the width as follows
      g_hierarchy_header-width = 200.
    *Reference the g_hierarchy_header structure when calling the following method
      CALL METHOD tree1->set_table_for_first_display
        EXPORTING
        is_hierarchy_header = g_hierarchy_header
          it_list_commentary  = gt_header[]
          is_variant          = g_variant
          i_save              = g_save...

  • Re-size Hierarchy column in ALV Tree

    Hi all,
    I have created a class inheriting from CL_GUI_ALV_TREE that is used to create a Tree structure for Equipment.....
    Now my requirement is that the Hierarchy column should be re-sized based on the width of the node text.
    Please help.
    Thanks in advance.....

    Not answered

  • Column Text in Tree

    How to change the column text in a tree? when the column length is very small, it should show the Heading from the Data Element.As the column length increases, column header should be Short Label,Medium Label,and long field label??

    Hi Nikhil,
       Which class are you using to create the tree?
    what i feel is when you change the column length at the same time you can update the internal table which you are passing for tree display with the field labels.
    and then call the refresh tree method.
    i dont think there is a direct method of doing the same where in the text gets auto updated, this happens only in case of screen elements.
    Hope this helps.
    regards,
    kinshuk

  • Right alignment for OO tree column

    Hi experts,
    how can i align the data of type characters in the OO tree alv display? i want to align it to the right.
    Thanks.

    Hello,
    Set Alignment of the Text in the Column
    You are able to set where the content of a column will be put:
    ·        Left aligned
    ·        Centered
    ·        Right-aligned
    You are able to change the alignment of text in the design object (header and footer area of page or list) and in the ALV output.
    Use the method CL_SALV_COLUMN SET_ALIGNMENT
    Check
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm

  • Editing of a  Column of ALV Tree(OOPS) node

    is it possible to edit a column of node of ALV tree.
    i am using ALV class "CL_GUI_ALV_TREE".
    After searching existing threads, for the same issue..i found the following.
    1) Editable Tree ALV
      ( displays pop up window where user can change values and then transfer these changes back to ALV tree)
    2) Editable Field in ALV TREE Display Using OOPs
         (this approach is not working for ALV Tree)
    But i want to edit directly coulmn of a node of ALV tree.
    is it possible in  OOPS ALV Tree?
    if it possible, can any one provide the sample code,

    As you already noticed, this is not possible, but you may edit your fields outside the tree and bring your changes back to tree. I struggled with the same once but eventually used described alternative. If you use saplink you may check upgrade [chain and rename|http://code.google.com/p/saplink-chain-and-rename/downloads/list] where this approach is released. The code is free so you will be able to study and copy whatever you need from it.
    Editing in a pop up is also an alternative here.
    Regards
    Marcin

  • Create columns for HTMLB:TREE

    Hi All,
    In our appplication we are are using <htmlb:tree />. Using CL_BSP_BEE_TABLE we were able to show checkbox inside the tree node. CL_BSP_BEE_TABLE was of great help.
    Now we need columns in tree. Is there a way to create columns using BEE?
    Thanks and regards,
    Bindiya

    I am using a tree with about 2500 nodes and and around 5000 final children (leaves)  and we dont face any problem using the approach i have explained in my weblog.
    i guess the best approach would be to just do it and check whether you are having problem.
    <i>Do you know of any good alternatives to the htmlb:tree?</i>
    there are other javascrip/dhtml trees but you will still face the same kind of issues.
    Regards
    Raja

  • Edit the column in ALV tree

    Hi Experts ,
                          I want to edit the column contents in a ALV tree and the save the content . I am using CL_ALV_gui_tree class to build the tree structure.please help on this
    With regards
    RKM

    Hi,
    In the field catalog internal table ,
    Fcat-edit  = 'X'.
    This makes the particular field as editable mode. append to field catelog internal table.
    include into your internal table.
    in the structure.
       types: cellstyles type lvc_t_styl.
    call this class
    class lcl_event_handlers definition.
      public section.
        methods:handle_button_click for event button_click of cl_gui_alv_grid
                                                              importing  es_row_no.   " METHOD TO HANDLE PUSH BUTTON
    endclass.                "lcl_event_handlers DEFINITION
    class lcl_event_handlers implementation.
    method handle_button_click.
    perform handle_button_click using   es_row_no .   " ACTION TO BE PERFORMED WHEN CLICKING ON PUSH BUTTON
    endmethod.
    layout :
    gs_layout-stylefname = 'CELLSTYLES'.
    endclass.
    ls_style-fieldname = 'BUTTON'.
    ls_style-style = cl_gui_alv_grid=>mc_style_button.
    append ls_style to wa_str-cellstyles.
    ***********button name
       wa_str-button = 'SAVE'.
       modify it_str from wa_str transporting button.

Maybe you are looking for