PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
DataGrid Problems

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures
View previous topic :: View next topic  
Author Message
vanila2000



Joined: 23 Jun 2006
Posts: 3

PostPosted: Fri Jun 23, 2006 1:39 pm    Post subject: DataGrid Problems Reply with quote

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 (&euro;)"
);
//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
View user's profile Send private message
vanila2000



Joined: 23 Jun 2006
Posts: 3

PostPosted: Wed Jun 28, 2006 11:18 am    Post subject: Reply with quote

Can anyone please help me out??? it is really urgent .. Thanks in adv.
Back to top
View user's profile Send private message
PinkCloud



Joined: 20 May 2008
Posts: 1

PostPosted: Tue May 20, 2008 10:42 am    Post subject: Reply with quote

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
View user's profile Send private message
vanila2000



Joined: 23 Jun 2006
Posts: 3

PostPosted: Wed May 21, 2008 7:29 am    Post subject: Reply with quote

No. unfortunately, this post has not received any reply at all and I had to switch to simple php programming for the report ...Sad
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1003

PostPosted: Wed May 21, 2008 10:48 pm    Post subject: Reply with quote

PinkCloud, please open a bug report on pear.php.net about this issue.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software