 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
luissilva
Joined: 11 Jul 2007 Posts: 1 Location: rio de janeiro - brazil
|
Posted: Wed Jul 11, 2007 4:57 pm Post subject: problem: DHTL_Table usage |
|
|
hi, i'm a beginner, and...
I am not obtaining to modify the font's attributes (size,color) in the table below. Can anyone help me? (changing the backgroun color is ok...) The script:
<?php
session_start();
require_once 'Structures/DataGrid.php';
require_once 'HTML/Table.php';
include 'db.php';
// Instantiate the DataGrid
$datagrid =& new Structures_DataGrid(13);
// Specify how the DataGrid should be sorted by default
$datagrid->setDefaultSort(array('ds_programa' => 'ASC'));
/* Required in order to use the 'fields' and 'labels' options */
$datagridOptions['generate_columns'] = true;
/* The fields we want to display */
$datagridOptions['fields'] = array ('ds_programa', 'dt_inicio', 'dt_fim');
/* Translate the fields names into user-friendly labels */
$datagridOptions['labels'] = array (
'ds_programa' => 'Programa',
'dt_inicio' => 'Data inicio',
'dt_fim' => 'Data fim'
);
// Setup your database connection
$datagridOptions['dsn'] = $dsn;
// Bind a basic SQL statement as datasource
$test = $datagrid->bind('SELECT g.ds_programa,p.dt_inicio,p.dt_fim FROM tb_processo p, tb_programa g WHERE p.co_programa = g.co_programa', $datagridOptions);
// Print binding error if any
if (PEAR::isError($test)) {
echo $test->getMessage();
}
// Define the Look and Feel
$tableAttribs = array(
"width" => "100%",
"cellspacing" => "0",
"cellpadding" => "4",
"class" => "datagrid",
"border" => "1",
"style" => "font-size=10px;color=yellow");
$headerAttribs = array(
'bgcolor' => '#7A96DF',
"style"=>"font-size=10px;color=yellow"
);
$evenRowAttribs = array(
'bgcolor' => '#FFFFFF'
);
$oddRowAttribs = array(
'bgcolor' => '#C6D5FD'
);
$rendererOptions = array(
'sortIconASC' => '⇑',
'sortIconDESC' => '⇓'
);
// Create a HTML_Table
$table = new HTML_Table($tableAttribs);
$tableHeader =& $table->getHeader();
$tableBody =& $table->getBody();
// Ask the DataGrid to fill the HTML_Table with data, using rendering options
$test = $datagrid->fill($table, $rendererOptions);
if (PEAR::isError($test)) {
echo $test->getMessage();
}
// Set attributes for the header row
$tableHeader->setRowAttributes(0, $headerAttribs);
// Set alternating row attributes
$tableBody->altRowAttributes(0, $evenRowAttribs, $oddRowAttribs, true);
// Output table and paging links
echo $table->toHtml();
// Display paging links
$test = $datagrid->render(DATAGRID_RENDER_PAGER);
if (PEAR::isError($test)) {
echo $test->getMessage();
}
?>
thanks in advance...
ls |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1003
|
Posted: Wed Jul 11, 2007 5:58 pm Post subject: |
|
|
Well, this can't work:
| Code: |
$tableAttribs = array(
"width" => "100%",
"cellspacing" => "0",
"cellpadding" => "4",
"class" => "datagrid",
"border" => "1",
"style" => "font-size=10px;color=yellow");
|
Instead of the "=", you need to use ":". For example, "font-size: 10px;".
You could also define the style "outside" your script, e.g. in an external .css file, and define the style for table#datagrid. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|