 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
vanila2000
Joined: 23 Jun 2006 Posts: 3
|
Posted: Fri Jun 23, 2006 1:39 pm Post subject: DataGrid Problems |
|
|
Hi,
I downloaded the example script given for datagrid. my script is like this:
<html>
<style type="text/css">
<!--
body {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
}
table.fruits {
border-left: solid 1px #990033;
border-top: solid 1px #990033;
border-bottom: solid 1px #990033;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
border-collapse: collapse;
width: 36em;
margin-left: 1em;
}
table.fruits th {
text-align: center;
border-right: solid 1px #990033;
border-bottom: solid 1px #990033;
background: #990033;
padding: 2px;
color: white;
padding-left: 1em;
padding-right: 1em;
}
table.fruits th a {
color: white;
text-decoration: none;
}
table.fruits th a:hover {
color: #EEEEEE;
}
table.fruits td {
text-align: right;
border-right: solid 1px #990033;
padding: 2px;
}
table.fruits tr.odd {
background: #F4F4F4;
}
p.paging {
text-align: center;
font-weight: bold;
}
p.paging a {
color: #990033;
}
-->
</style>
<?php
/* Includes */
require_once "PEAR.php";
define("DB_DATAOBJECT_NO_OVERLOAD",true); /* This is needed for some buggy versions of PHP4 */
require_once "DB/DataObject.php";
require_once "Structures/DataGrid.php";
/* Database and DataObject setup */
$options = &PEAR::getStaticProperty("DB_DataObject","options");
$options["database"] = "oci8://user:passwd@host/dbname"; (i am giving my own user here)
$options["proxy"] = "full";
DB_DataObject::debugLevel(0);
class DataObject_Fruits extends DB_DataObject
{
var $__table = "fruits";
var $id;
var $name;
var $stock;
var $price;
}
/* Instantiate */
$dataobject = new DataObject_Fruits();
$dataobject->keys("id");
$datagrid =& new Structures_DataGrid(10); /* 10 rows per table */
/* Required in order to use the "fields" and "labels" options */
//global $datagridOptions;
$options["generate_columns"] = true;
/* The fields we want to display */
$options["fields"] = array ("id","name", "stock", "price");
/* Translate the fields names into user-friendly labels */
$options["labels"] = array (
"id"=>"Product Id",
"name" => "Product Name",
"stock" => "Quantity in Stock",
"price" => "Price (€)"
);
//print_r($datagridOptions);
echo "<p align=\"center\" > size=\"4\"> FRUIT WISE REPORT <br>";
/* Pass these options at binding time */
$datagrid->bind($dataobject,$print_r);
/* Get a reference to the Renderer object */
$renderer =& $datagrid->getRenderer();
/* For the <table> element : */
$renderer->setTableAttribute("class", "fruits");
/* For every odd <tr> elements */
$renderer->setTableOddRowAttributes(array ("class" => "odd"));
$pagingHtml = $renderer->getPaging();
echo "<p class=\"paging\">Pages : $pagingHtml</p>";
/* And render */
$datagrid->render();
?>
Here, whenever i try to change the labels in the output, the data is not printed. That is in the bind statement like this:
$datagrid->bind($dataobject,$datagridOptions);
However, if i give
$datagrid->bind($dataobject,$print_r);
I am getting the data with the table field names as the labels.
I want to change the lables. How do i do it? Even though in the code i have defined the labels, it is not printed. Please tell me how to do it. |
|
| Back to top |
|
 |
vanila2000
Joined: 23 Jun 2006 Posts: 3
|
Posted: Wed Jun 28, 2006 11:18 am Post subject: |
|
|
| Can anyone please help me out??? it is really urgent .. Thanks in adv. |
|
| Back to top |
|
 |
PinkCloud
Joined: 20 May 2008 Posts: 1
|
Posted: Tue May 20, 2008 10:42 am Post subject: |
|
|
Hi there,
I have been trying to attempt to exactly the same thing as you, but when i try to change the label the data does not print.
I know this post is quite old now, but has anyone got any answers on how to do this? _________________ | Label Printing | Printed Labels | - PinkCloud |
|
| Back to top |
|
 |
vanila2000
Joined: 23 Jun 2006 Posts: 3
|
Posted: Wed May 21, 2008 7:29 am Post subject: |
|
|
No. unfortunately, this post has not received any reply at all and I had to switch to simple php programming for the report ... |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1003
|
Posted: Wed May 21, 2008 10:48 pm Post subject: |
|
|
| PinkCloud, please open a bug report on pear.php.net about this issue. |
|
| 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
|
|