CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Changing Table Cell Color

Print topic Send  topic

Author Message
Dygar
Posted: 09/19/2003, 3:57 PM

I'm wanting to change a cell color based on a db value but the code example in the tutorial and code charge help is causing errors.

Here's what Help suggests as a solution:


1. Switch to HTML mode
2. Add two Labels called RowStyle and RowStyle1:

<!-- BEGIN Row -->
<tr>
<td class="{RowStyle}">{TaskName}</td>
<td class="{RowStyle1}">{Status}</td>
</tr>
<!-- END Row -->

3. Add the Before Show Row event to the Tasks grid.
4. Within the event, add the code below:

function Tasks_BeforeShowRow() {
global $Counter;
global $Tasks;
if ($Counter == 0) {
$Tasks->RowStyle->SetValue("ClearDataTD");
$Tasks->RowStyle1->SetValue("ClearDataTD");
$Counter = 1;
} else {
$Tasks->RowStyle->SetValue("ClearAltDataTD");
$Tasks->RowStyle1->SetValue("ClearAltDataTD");
$Counter = 0;
}
}

I've of course changed all the object and label references to fit my own code but I'm still getting this error when I run it:

Fatal error: Call to a member function on a non-object in blah blah blah

From the debugging I've done it seems like the reference to the function 'SetValue' for 'RowStyle' and 'RowStyle1' are the non member functions that the error is referring to but that's what the Help manual said to do.

In my case my grid is called Issues so my code looks like this:

function Issues_BeforeShowRow()
{
$Issues_BeforeShowRow = true;
//End Issues_BeforeShowRow

//Custom Code @106-F7CB117B
// -------------------------
global $Issues;
// if ($Issues->ds->Stat->GetValue() == "C"){ // This line works
$Issues->RowStyle->SetValue("KnockoutDataTD"); // This line blows up
// -------------------------
//End Custom Code

//Close Issues_BeforeShowRow @19-EC3A4E01
return $Issues_BeforeShowRow;
}
//End Close Issues_BeforeShowRow

My html looks like this:

<!-- BEGIN Row -->
<tr>
<td class="{RowStyle}"><a class="KnockoutDataLink" href="{Iid_Src}">{Iid}</a> </td>
<td class="KnockoutDataTD">{Stat}</td>
<td class="KnockoutDataTD">{Stamp} </td>
</tr>
<!-- END Row -->



Anyone have any advice?

Thanks.
DaveRexel
Posted: 09/19/2003, 4:45 PM

::
This post may help you

http://www.rexdesign.com/ccs/kb.php?category_id=47&lang...d=7&event_id=82
(free registration required)

Greetings
Dave
Dygar
Posted: 09/22/2003, 8:57 AM

Great site and that solved my problem perfectly. Thanks.
DaveRexel
Posted: 09/22/2003, 10:58 AM

::
Hi Dygar
Glad to be of service

Regards
Dave

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.