On Wed, Jul 8, 2009 at 10:33 AM, <[email protected]> wrote:
>
> I followed your instructions and overwrite css methods by subclassing
> qx.ui.table.cellrenderer.Abstract and overwriting _getContentHtml method. I
> would like to try to get the same effect by overwriting _getCellClass
> method. My question is: where should I define mySpecialCssClass? Is this a
> pure css file? If so how to include it into the project?
In the source directory there is a file called index.html
Here is an example index.html that links to a css file called 'special.css'.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Project Title.</title>
<link href="special.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="script/pd.js"></script>
</head>
<body></body>
</html>
You can also embed css directly into the index.html file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Project Title.</title>
<STYLE type="text/css">
.mySpecialCssClass { font-weight: 700; font-variant: smallcaps; }
.myOtherSpecialCssClass { textColor: #999999; }
</STYLE>
<script type="text/javascript" src="script/pd.js"></script>
</head>
<body></body>
</html>
This last setup at least prevents _another_ server-side request, and should
be preferred.
Here you see me define a "mySpecialCssClass" (notice the dot in the
definition above, it is needed for css-classes)
Also, some css-classes that are already defined and usuable in the
TabeCellRenderer._getCellClass() are:
qooxdoo-table-cell-bold, qooxdoo-table-cell-italic, qooxdoo-table-cell-right
You can assign more than one css class to each cell, by adding them to the
line separated by spaces.
////////////////////////////////////////////
qx.Class.define("myProject.myCellRenderer",{
extend: qx.ui.table.cellrenderer.Abstract,
construct:function(){
////////////////////////////////////////////
this.base( arguments );
///////////
},members:{
///////////
_getCellClass:function(cellInfo){
var cellClass = this.base(arguments, cellInfo);
if( !cellClass || cellInfo.value == null ) return "";
return cellClass + " mySpecialCssClass myOtherSpecialCssClass";
}
////
}});
////
You can also define your own RowRenderers.
It works pretty simelar to cellrenders, except they are applied to the whole
row, and get the whole rowdata.
I used this to make rows that are 'new' or 'unread' a different color.
In reality I don't bother making custom cellrenders for each and every class
instead, I put them in my column models.
So I have a generic cellrenderer like this;
qx.Class.define("oo.table.CellRenderer",{
extend: qx.ui.table.cellrenderer.Abstract,
construct:function( vColumn ){
this.base( arguments );
this.setColumnModel( vColumn );
//////////////
},properties:{
//////////////
columnModel:{ check:'oo.model.column.Abstract' }
///////////
},members:{
///////////
_getContentHtml:function( cellInfo ){
if( cellInfo.value == null ) return "";
var cm = this.getColumnModel();
return cm.formatHtml( cm.parseValue( cellInfo.value ), cellInfo.rowData
);
},
_getCellClass:function(cellInfo){
var cellClass = this.base(arguments, cellInfo);
if( !cellClass || cellInfo.value == null ) return "";
return cellClass + " " + this.getColumnModel().getTableCSS();
}
////
}});
////
Because I would advise you, if you don't want to go crazy, to have nice
models for your database structure. Like having a specific class for each
table, and having a specific class for each fieldtype you use. I use the
column models (the models of the fieldtypes, like text, string .. date) as
factory classes for form-widgets, cellrenders, validation,
end-user-formatting, etc.
Greetings,
Ralf
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel