On Thu, Feb 4, 2010 at 03:58, Fritz Zaucker <fritz.zauc...@oetiker.ch>wrote:

> Hi,
>
> I have a table with say 5 columns. I'd like to have a different background
> color in one of these columns (e.g. column 3).
>
> As far as I could figure out the background color is set in the
> RowRenderer,
> but for the whole row. So the next obvious choice would be the
> CellRenderer.
> However, it is not clear to me how the two might interfere in this respect.
>
> And (similar) issue arises if I'd like to set a different background color
> for a specific cell, e.g. similar to the Conditional CellRenderer (which
> unfortunately only let's me specify styles for the cell content).
>
> I'd appreciate any hints on how to implement something like that.
>

Here's an example of doing what you ask:

http://demo.qooxdoo.org/devel/playground/#%7B%22code%22%3A%20%22qx.Class.define%28%2522custom.MyCellRenderer%2522%252C%250A%257B%250A%2520%2520extend%2520%253A%2520qx.ui.table.cellrenderer.Default%252C%250A%2520%2520%250A%2520%2520members%2520%253A%250A%2520%2520%257B%250A%2520%2520%2520%2520_getCellStyle%2520%253A%2520function%28cellInfo%29%250A%2520%2520%2520%2520%257B%250A%2520%2520%2520%2520%2520%2520var%2520color%2520%253D%2520%28cellInfo.row%2520%2525%25202%2520%253D%253D%25201%2520%253F%2520%2522cyan%2522%2520%253A%2520%2522white%2522%29%253B%250A%2520%2520%2520%2520%2520%2520return%2520this.base%28arguments%252C%2520cellInfo%29%2520%252B%2520%2522background-color%253A%2522%2520%252B%2520color%2520%252B%2520%2522%253B%2522%253B%250A%2520%2520%2520%2520%257D%250A%2520%2520%257D%250A%257D%29%253B%250A%250Afunction%2520createRandomRows%28rowCount%29%2520%257B%250A%2520%2520var%2520rowData%2520%253D%2520%255B%255D%253B%250A%2520%2520var%2520now%2520%253D%2520new%2520Date%28%29.getTime%28%29%253B%250A%2520%2520var%2520dateRange%2520%253D%2520400%2520*%252024%2520*%252060%2520*%252060%2520*%25201000%253B%2520%252F%252F%2520400%2520days%250A%2520%2520var%2520nextId%2520%253D%25200%253B%250A%2520%2520for%2520%28var%2520row%2520%253D%25200%253B%2520row%2520%253C%2520rowCount%253B%2520row%252B%252B%29%2520%257B%250A%2520%2520%2520%2520var%2520date%2520%253D%2520new%2520Date%28now%2520%252B%2520Math.random%28%29%2520*%2520dateRange%2520-%2520dateRange%2520%252F%25202%29%253B%250A%2520%2520%2520%2520rowData.push%28%255B%2520nextId%252B%252B%252C%2520Math.random%28%29%2520*%252010000%252C%2520date%252C%2520%28Math.random%28%29%2520%253E%25200.5%29%2520%255D%29%253B%250A%2520%2520%257D%250A%2520%2520return%2520rowData%253B%250A%257D%250A%250A%250A%252F%252F%2520window%250Avar%2520win%2520%253D%2520new%2520qx.ui.window.Window%28%2522Table%2522%29.set%28%257B%250A%2520%2520layout%2520%253A%2520new%2520qx.ui.layout.Grow%28%29%252C%250A%2520%2520allowClose%253A%2520false%252C%250A%2520%2520allowMinimize%253A%2520false%252C%250A%2520%2520contentPadding%253A%25200%250A%257D%29%253B%250Athis.getRoot%28%29.add%28win%29%253B%250Awin.moveTo%2830%252C%252040%29%253B%250Awin.open%28%29%253B%250A%250A%252F%252F%2520table%2520model%250Avar%2520tableModel%2520%253D%2520new%2520qx.ui.table.model.Simple%28%29%253B%250AtableModel.setColumns%28%255B%2520%2522ID%2522%252C%2520%2522A%2520number%2522%252C%2520%2522A%2520date%2522%252C%2520%2522Boolean%2522%2520%255D%29%253B%250AtableModel.setData%28createRandomRows%281000%29%29%253B%250A%250A%252F%252F%2520make%2520second%2520column%2520editable%250AtableModel.setColumnEditable%281%252C%2520true%29%253B%250A%250A%252F%252F%2520table%250Avar%2520table%2520%253D%2520new%2520qx.ui.table.Table%28tableModel%29.set%28%257B%250A%2520%2520decorator%253A%2520null%250A%257D%29%250Awin.add%28table%29%253B%250A%250Avar%2520tcm%2520%253D%2520table.getTableColumnModel%28%29%253B%250A%250A%252F%252F%2520Display%2520a%2520checkbox%2520in%2520column%25203%250Atcm.setDataCellRenderer%283%252C%2520new%2520qx.ui.table.cellrenderer.Boolean%28%29%29%253B%250A%250A%252F%252F%2520Use%2520the%2520custom%2520cell%2520renderer%2520for%2520column%25201%250Atcm.setDataCellRenderer%281%252C%2520new%2520custom.MyCellRenderer%28%29%29%253B%250A%250A%252F%252F%2520use%2520a%2520different%2520header%2520renderer%250Atcm.setHeaderCellRenderer%282%252C%2520new%2520qx.ui.table.headerrenderer.Icon%28%2522icon%252F16%252Fapps%252Foffice-calendar.png%2522%252C%2520%2522A%2520date%2522%29%29%253B%250A%22%7D

Cheers,

Derrell
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to