1 Reply Latest reply: Jan 18, 2013 9:57 PM by sselvia RSS

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

    sselvia
      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?
        • 1. Re: TableView auto resize columns based on header text width or cell content
          sselvia
          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.