qooxdoo

How do you create a table cell renderer that conditionally applies a text-decoration of line-through?


I'm trying to style a qx.ui.table.Table so some of its rows are conditionally styled with a text-decoration of line-through. I'm able to use qx.ui.table.cellrenderer.String to apply some styling, but not text-decoration changes. How can this be done?


Solution

  • You are talking about trying to modify the style of a cell when you refer to qx.ui.table.cellrenderer.String, but you stated that you wanted to style the whole row as line-through. If you really want to do it on a cell-by-cell basis, the style of a cell is determined in the cell renderer, by the _getCellStyle method. An example of its use is in the cell renderer qx.ui.table.cellrenderer.Conditional. Your case may be much simpler. In fact, if the conditions under which you ascertain whether to do line-through are available in the cell- or row data, you could extend qx.ui.table.cellrenderer.String, adding a _getCellStyle method that returns the desired style.

    Likely, though, based on your description, you want to instead implement your own row renderer. You would create a row renderer that extends qx.ui.table.rowrenderer.Default, and override the createRowStyle method.