TableView auto resize columns based on header text width or cell content

Is there a method on the tableview or tablecolumn to automatically resize based on the content of the hearder or data?
If not what approach can used used with JavaFX to calculate the string width based on the current font?

The table column size is inconsistent, I set the columns in the table view and the items in the initialize method. I execute a service and task from a button action that loads data into the list, if I don't reset the columns in the table view in the succeed method then each column is the same width regardless of the content in the cells. If I do reset the table columns in the succeed method then the columns are resized based on content.
I don't think it should be a requirement to reset the columns just to get the column widths to set based on the content in the cells. Is there a method on the table column or view that will resize the cells based on the cell content? I would prefer the largest value; column header content or the longest cell content for a column.

Similar Messages

  • Resize textarea based on external text doc

    I am wanting to make a scroller. I have it all working fine
    except the fact that i need the textArea to resize itself based on
    the amount of text that it is loaded. I have created one that
    scrolls vertical, i used scroller._height = scroller.length. and
    that sizes the text area to the amount of text that is there. But
    not i need a horizontal, side to side, and am not sure how to get
    the text area to size its width. Can anyone help?
    Thank you for your time

    The table column size is inconsistent, I set the columns in the table view and the items in the initialize method. I execute a service and task from a button action that loads data into the list, if I don't reset the columns in the table view in the succeed method then each column is the same width regardless of the content in the cells. If I do reset the table columns in the succeed method then the columns are resized based on content.
    I don't think it should be a requirement to reset the columns just to get the column widths to set based on the content in the cells. Is there a method on the table column or view that will resize the cells based on the cell content? I would prefer the largest value; column header content or the longest cell content for a column.

  • Viewer Auto Resizes Columns – when too many columns

    Hi Guys,
    I’ve created a report in Desktop and am viewing it through Viewer (4.1). The report itself is a simple ‘table’ report with quite a lot of columns. (that’s where my problem comes in). I’m trying to tidy it up (mostly column X), therefore have wrapped a few columns in Discoverer Desktop all should look good….right?… well not quite ;-(
    When viewing the Report in Viewer, Viewer has automatically resized or shrunk the columns. I have 24 columns in the report and even after Viewer has done it’s own resize to my columns, I still need to use the scroll bar to view columns to the right. So what was the point of Viewer doing that in the first place? Anyways, column X was originally word wrapped and expanded to include a lengthy description, however after being “Viewered” it is now the width of the heading text itself. Data within this columns is still wrapped, but by the size of the column heading.
    I’ve noticed that if I start taking columns out one by one, Viewer will resize and increase the column size by a tiny amount. So to be able to display column X as required in Viewer, I’d have to take out 18 columns to be left with 6, which would then show Column X as the right size.
    Please tell me if there is any workaround or settings that can be amended in the Pref.txt file?
    Thanks,
    Lance
    Message was edited by:
    Lance Botha

    Hi Lance
    There is nothing you can do in 4i to control this behavior, one very good reason to upgrade.
    Discoverer Viewer will resize its columns in an attempt to fit them on a single page. It does this very well when the number of columns allows this. When you have more columns than can fit into a single page you will get multiple pages. If you reduce the headings for some of the columns are you able to get it to compress into a single page? If not, I fear you cannot do more.
    Best wishes
    Michael

  • Auto resize columns.

    How can i get finder to auto resize my columns in columns view?
    (I know how to option-click resize them)
    best...Jan

    to resize the grey bar on the left, all you need to do is move the arrow to the line on the edge of the box, the far right line and the little symbol that allows you to adjust windows appears and then you can adjust it to any size of your preference. as for the auto-sizing columns, i don't even know how to change the size so i wouldn't know how to auto size it...sorry. hope that helps
    regards,
    thealexness

  • Find all PO number based on Header Text

    Hello Everyone,
    I have a requirement where in I am making a search help with PO number and Header Text as the search fields.Now,with the PO number I am able to find all the header text by using READ_TEXT FM.
    Now if user enters the header text  only and presses F4 then all corresponding PO numbers should be also displayed .
    Kindly let me know if there is any way of fetching the PO numbers based on the header text.
    Thanks,
    Regds,
    Vijaya
    Moderator message - Moved to the correct forum
    Edited by: Rob Burbank on Nov 18, 2009 9:11 AM

    Hi,
    What exactly you want ?Check in the table
    J_1IEXCDTL                     Excise invoice line item details
    J_1IEXCHDR                     Excise invoice header details
    Regards,]
    Chetan.

  • JTabbedPane, switch of auto resizing of the tab header possible?

    Hi,
    Is it possible to prevent the tab header from auto resizing?
    In this code the tab "Page 1" fills the whole row at start up, but I would like to prevent it from taking more space than needed.
    import java.awt.*;
    import javax.swing.*;
    class TabbedPaneExample
            extends     JFrame
        private        JTabbedPane tabbedPane;
        private        JPanel        panel1;
        private        JPanel        panel2;
        private        JPanel        panel3;
        public TabbedPaneExample()
            // NOTE: to reduce the amount of code in this example, it uses
            // panels with a NULL layout.  This is NOT suitable for
            // production code since it may not display correctly for
            // a look-and-feel.
            setTitle( "Tabbed Pane Application" );
            setSize( 140, 200 );
            setBackground( Color.gray );
            JPanel topPanel = new JPanel();
            topPanel.setLayout( new BorderLayout() );
            getContentPane().add( topPanel );
            // Create the tab pages
            createPage1();
            createPage2();
            createPage3();
            // Create a tabbed pane
            tabbedPane = new JTabbedPane();
            tabbedPane.addTab( "Page 1", panel1 );
            tabbedPane.addTab( "Page 2", panel2 );
            tabbedPane.addTab( "Page 3", panel3 );
            topPanel.add( tabbedPane, BorderLayout.CENTER );
        public void createPage1()
            panel1 = new JPanel();
            panel1.setLayout( null );
        public void createPage2()
            panel2 = new JPanel();
            panel2.setLayout( new BorderLayout() );
        public void createPage3()
            panel3 = new JPanel();
            panel3.setLayout( new GridLayout( 3, 2 ) );
        // Main method to get things started
        public static void main( String[] args )
            // Create an instance of the test application
            TabbedPaneExample mainFrame    = new TabbedPaneExample();
            mainFrame.setVisible( true );
    }Edited by: user6102378 on 2010-okt-07 06:51

    Unfortunately, the answer seems to be "no" - looks like the exact behaviour is even different across different LAFs. Nothing short of re-writing the layout code in the xxTabbedPaneUI will help.
    Just curious: how comes that we have so many tabbedPane related questions recently?
    Cheers
    Jeanette

  • Auto adjust RichColumn header text width

    Hi.
    My column in RichTable (11g) has a header title "X". In the backing bean I programatically change it to "XXXXXXXXXXXXX".
    How can I adjust column header width so it will include the whole "XXXXXXXXXXXXX" text.
    Of course I can set the width of the column , but I need to know how to calculate the width according to the text length
    Please advice

    can you try setting the column width to 100% or having it in a panelStretchLayout ?

  • Can't auto-resize columns in List View

    In 10.6 one could double-click the divider between columns to automatically have them resize to an optimal width. I can't do that. Is this intended behavior? Note: I'm not using the new "Arrange By..." feature which disables movement entirely.

    Wow ! - I humbly apologise.
    I have 3 different machines with Lion and so have my colleages.
    For all of us the two vertical lines disappeared in Lion.
    We can get a vertical stretch icon by hovering the mouse over the divider and double clicking this gives the same result.
    We have 10.7.1 - so what gives?

  • Auto-resizing pop-up window

    What I'm doing is making a calendar and when you click on a
    day a small pop-up window of that day's activities pops up. Well
    not all the days have the same amount of activities, so is it
    possible to have pop-up windows that auto-resize according to how
    much text is in the pop-up window?

    i dont know of any extensions that provide this....
    however you could do something based on # characters. create
    some calculation for the height of the window based on #
    characters.

  • Unable to view document header text in MB51

    When creating a stock transport order in MB1B we are entering information into a field labeled "document header text". Then when running MB51 in the column labelled document header text nothing appears unless we enter under a specific movement type.  If we use another movement type the text does not transfer.
    Please assist.
    Thank you.

    Try using SELECT_TEXT in place of READ_TEXT.
    Hope this helps.
    Regards
    vinayak

  • Limit columns based on variable value

    Gurus,
       My requirement;
       User will enter a value "A" in the variable and based on the value i need to limit
       the columns in the output. for example in the query designer i have 6 fields in
       Rows, in Free Chars i have the field with variable which user will enter. if the value
       entered is "A" only 4 fields should appear on the report else if value is "B" only
       the other 2 fields should appear.
       Is there a way accomplish this...please suggest
    Thanks with points in advance...

    Geni,
    Are u using the Excel based Analyzer as your Front End?
    If so you can run a small VBA (on event SAPBEXonrefresh) that will hide columns based on the value of the cell that displays the value of the variable that the user is setting.
    See code i posted in Re: How do I make cells "0" and not blank for an example.
    Is this what you are after?
    Hope it helps,
    Gili

  • TableView: column header text alignment?

    How can I change the text alignment of a TableView column caption/header? I'd like some of my column headers to be right aligned for example?
    It works for regular table cells when I change f.i. the css of the custom DataFX MoneyTableCell cell:
    .money-cell {
       -fx-alignment: TOP_RIGHT;
    }but it won't work for the ".table-view .column-header" style of the standard TableView:
    .table-view .column-header,
    .table-view .filler,
    .table-view .column-drag-header {
        -fx-alignment: TOP_RIGHT;
    }

    Just after raising this I realised the problem is that the text is a label on top of the header. You can right align by using the following selector:
    .table-view .column-header .label {
        -fx-alignment: TOP_RIGHT;
    }

  • How to change JTable column header text

    How do you set the text in the JTable column headers? I know you can create a JTable specifying the text in an array:
    <li>JTable(Object[][] rowData, Object[] columnNames)
    But if you create the JTable specifying a TableModel,
    <li>JTable(TableModel dm)
    the header text defaults to "A", "B", "C", etc. I cannot figure out how to access the text in the header names so it can be changed to something useful. I know how to get the JTableHeader for the table, but it does not seem to have methods for actually setting header values.

    I'm sure that model allows you to specify header values so you don't have to do so manually. I would be very surprised if it didn't override the default getColumnName() method to provide a reasonable names.She wasn't writing the class, but [url http://forums.oracle.com/forums/thread.jspa?messageID=9200751#9200751]outlining a design for me to implement. And, based on a previous comment I had made, I think she assumed I wanted the new design to look as much like the old as possible. There were no headers in the original design, which wasn't even a table.
    Anyway, this works:
        final static String statisticsColumnNames[] = {
         "Type", "Count",
         "Red QE", "Green QE", "Blue QE", "Average QE",
         "Distance"
         qErrors = new QEBeanTableModel();
         JTable errorTable = new JTable(qErrors);
         TableColumnModel tcm = errorTable.getColumnModel();
         for (int col = 0; col < statisticsColumnNames.length; col++)
             tcm.getColumn(col).setHeaderValue(statisticsColumnNames[col]);
    It looks like setHeaderValue() on the TableColumn is what I was looking for.Again, only used if you are dynamically changing the values at run time or you don't like the defaults provided by the Bean-aware model.I coded the above before I read your last post. The QEBeanTableModel is extremely specific to my program. I.e. I cannot imagine it being used anywhere else. Would it still be better to implement a getColumnName() within the table model? Looking at your [url http://www.camick.com/java/source/RowTableModel.java]RowTableModel.java source, I can see that it would not be difficult to do so.
    Just decided to add the getColumnName() method. This whole sub-project is based on implementing a clean modern design (and learning about Java Beans). You've clearly stated twice that the method I have implemented is for dynamic header values only, which has already answered what I asked last paragraph.

  • How to define Column Header text table control

    Hi All,
    I have to create a function in which user will pass Field Name, Field Description.
    I have to show that field description in Table Control Columns as Text for columns.
    Like if a user pass Material , PLant etc, then first column header text will be Material and so on and in rows it will show the data.
    One more thing, is it possible to define the technical attributes like length based on field passed through function.
    Please help me to find out the solution.
    Thanks
    Piyush Mathur

    Hi Piyush,
    here are the some components of the screen . you can change tehm at run time in your code.
    components: name,input,output,required,length,active,invisible,intensified,group1,group2...etc.
    at ruin time you modify these attributes..
    your requirement is to change the name attribute.
    regards,
    sateesh

  • How to create column header text while downloading file

    How can we create column header text while downloading file using function GUI_DOWNLOAD(in SAP Release 4.6c) because there is no FIELDNAMES parameter in
    4.6c version.

    Hii,
      Check this sample code. I have called GUI_DOWNLOAD twice. Onetime to download header of table and next time data of table
    REPORT  z_file_download.
    DATA: w_name(90) TYPE c.
    DATA:
      BEGIN OF fs_flight,
        carrid   LIKE sflight-carrid,
        connid   LIKE sflight-connid,
        fldate   LIKE sflight-fldate,
        price    LIKE sflight-price,
        currency LIKE sflight-currency,
      END OF fs_flight.
    DATA:
      BEGIN OF fs_head,
        carrid(10) TYPE c,
        connid(10) TYPE c,
        fldate(10) TYPE c,
        price(10) TYPE c,
        curr(10) TYPE c,
      END OF fs_head.
    DATA:
      t_head LIKE
       TABLE OF
             fs_head.
    DATA:
      t_flight LIKE
         TABLE OF
               fs_flight.
    fs_head-carrid = 'CARRID'.
    fs_head-connid = 'CONNID'.
    fs_head-fldate = 'FLDATE'.
    fs_head-price  = 'PRICE'.
    fs_head-curr   = 'CURRENCY'.
    APPEND fs_head TO t_head.
    SELECT-OPTIONS:
      s_carrid FOR fs_flight-carrid.
    START-OF-SELECTION.
      SELECT carrid
             connid
             fldate
             price
             currency
        FROM sflight
        INTO TABLE t_flight
       WHERE carrid IN s_carrid.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        filename                      = 'D:\flight.xls'
       FILETYPE                      = 'ASC'
    *   APPEND                        = ' '
        WRITE_FIELD_SEPARATOR         = 'X'
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    *   CONFIRM_OVERWRITE             = ' '
    *   NO_AUTH_CHECK                 = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   WRITE_BOM                     = ' '
    * IMPORTING
    *   FILELENGTH                    =
      tables
        data_tab                      = t_head
    EXCEPTIONS
       FILE_WRITE_ERROR              = 1
       NO_BATCH                      = 2
       GUI_REFUSE_FILETRANSFER       = 3
       INVALID_TYPE                  = 4
       NO_AUTHORITY                  = 5
       UNKNOWN_ERROR                 = 6
       HEADER_NOT_ALLOWED            = 7
       SEPARATOR_NOT_ALLOWED         = 8
       FILESIZE_NOT_ALLOWED          = 9
       HEADER_TOO_LONG               = 10
       DP_ERROR_CREATE               = 11
       DP_ERROR_SEND                 = 12
       DP_ERROR_WRITE                = 13
       UNKNOWN_DP_ERROR              = 14
       ACCESS_DENIED                 = 15
       DP_OUT_OF_MEMORY              = 16
       DISK_FULL                     = 17
       DP_TIMEOUT                    = 18
       FILE_NOT_FOUND                = 19
       DATAPROVIDER_EXCEPTION        = 20
       CONTROL_FLUSH_ERROR           = 21
       OTHERS                        = 22
    IF sy-subrc NE 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'D:\flight.xls'
          filetype                = 'ASC'
          append                  = 'X'
          write_field_separator   = 'X'
        TABLES
          data_tab                = t_flight
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc EQ 0.
        MESSAGE 'Download successful' TYPE 'I'.
      ENDIF.
      IF sy-subrc NE 0.
    *  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Regards
    Abhijeet

Maybe you are looking for

  • Problem in RFC destination

    Hi all, When i am trying to call a RFC FM, it askes me for an additional logon of the target system before giving the results. Please let me know is it necessary to give additional logon details or do i need to cange any settings in SM59. Thanks in a

  • Rounding of Percent allocation in Requisition

    We have applied the patch 4205128 already. The allocation total shows as 99.775647 but it should be rounded of to 100% for us to proceed further. Let me know if there are any setups for this. Thanks,

  • No stereo effect

    In my MacBook Pro  apr 2012 ,  i am not able to get Stereo Effect in  the Song , the left and Right PAn works but if u play it will be mono and i have plugged in stereo Headphones and 2.1CH speakers , still the output is MONO . please give me the Sol

  • I didnt receive any email after reset my apple id password

    I forget my apple id password and security questions, so i reset my apple id but i didnt receive any email in yahoo. apple support didnt help me, thay said you must forget your iphone.please help me.

  • Flash player crashes, Random restarts

    Hello, Since I built my computer I have been having problems with the flash player randomly crashing. Sometimes it works sometimes it doesnt. My comp is also randomly restarting. These issues seem to be related. I am Currently using the latest versio