2 Replies Latest reply: Apr 25, 2013 12:57 PM by 990159 RSS

    Access cell of a column using a given index?

    990159
      I have the index (as integer) of a cell in a TableColumn of a TableView. Using the index of the cell, how can I access the cell object at this index? I am missing something like
      tableColumn.getCells()
      which would then allow me to access the cell with the given index:
      tableColumn.getCells().get(index)
      Any hints on this? Thanks!

      Update: Please note that I do not want to access the content of the cell, but want to change the style of the cell, so I really need a reference to the cell itself.

      Edited by: srynoname on 25.04.2013 07:46
        • 1. Re: Access cell of a column using a given index?
          983995
          As far as i remember i never saw such a method.

          Maybe you could do it another way:

          - Create a custom TableCell
          - Override the 'updateItem' method
          - Add a change listener on a specific property of your item data
          - React to these changes by modifying the aspect of the cell
          - Set the custom TableCell to your TableColumn with setCellFactory

          Then you just have to play with the property of an item to make the cell changes

          NB: not tested but should work
          • 2. Re: Access cell of a column using a given index?
            990159
            adding a changelistener to a property of an item sounds like a really good idea for me :-)
            selected as answer, because there seems to be really no API for that, as per http://stackoverflow.com/questions/16217628/access-cell-of-a-column-using-a-given-index?