CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Highlighting a row

Print topic Send  topic

Author Message
lvalverdeb

Posts: 299
Posted: 12/23/2005, 7:21 AM

With the move form Themes to Styles, the technique for highlighting a row in a grid also stopped working. The following fix works with CCS 3:

The procedure for implementing this is very similar to Walter's Alternate Rows.

1 - Locate the section in your grid where rows are generated:

  
<tr class="Row">  

2 - Add a label right after class atrribute:

  
<tr class="Row" {highlight}>  

3- In the BeforeShowRow event of the grid:
  
$Component->highlight->SetValue("onmouseover='this.className=\"AltRow\"' onmouseout='this.className=\"Row\"'");  


Luis

_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
feha


Posts: 712
Posted: 12/26/2005, 6:33 PM

Thanks Luis

here is my version
(Alt Rows converted from Dave Rexel to CCS 3.0 )

  
	  global $Tpl;  
	  $highlight = "";  
  global $tindex;  
  $tindex <= 0 ? $tindex = 1 : $tindex++;  
  ($tindex  % 2) == 1 ? $RowClass = "Row" : $RowClass = "AltRow";  
  $Tpl->SetVar("RowClass",$RowClass);  
  if($RowClass == "Row")  
  {  
  $highlight = "onmouseover='this.className=\"AltRow\"' onmouseout='this.className=\"Row\"'";   
  }  
  else  
  {  
  $highlight = "onmouseover='this.className=\"Row\"' onmouseout='this.className=\"AltRow\"'";     
  }   
  $Tpl->SetVar("highlight",$highlight);  

in html
  
<!-- BEGIN Row -->  
            <tr class="{RowClass}" {highlight}>  
enjoy :-)

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 12/26/2005, 7:45 PM

When using alternate rows create own css class:

  
....  
if($RowClass == "Row")    
  {    
  $highlight = "onmouseover='this.className=\"MyClass\"' onmouseout='this.className=\"Row\"'";     
  }    
  else    
  {    
  $highlight = "onmouseover='this.className=\"MyClass\"' onmouseout='this.className=\"AltRow\"'";       
  }     

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
Benjamin Krajmalnik
Posted: 12/28/2005, 5:22 PM

feha,

instead of incrementing $tindex and then performing a modulus, you could
"not" it.
It is a faster operation and simpler to code.

Look at my post on ALternating Rows in Grid in reply to Walter.

feha


Posts: 712
Posted: 12/29/2005, 2:27 PM

Sure :-)

thank you Benjamin
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
chaitanya
Posted: 01/24/2006, 12:24 PM

Good
feha


Posts: 712
Posted: 01/31/2006, 2:18 AM

Here is a Benjamin solution to faster Alt Rows extented with mouseover:

  
//Custom Code @148-2A29BDB7  
// -------------------------  
    // Write your own code here.  
		global $Tpl;  
		$highlight = "";  
		global $isAltRow;  
		$RowClass = "Row";  
		if($isAltRow) {  
		$RowClass = "AltRow";  
		}  
		$isAltRow = (!$isAltRow);  
		$Tpl->SetVar("RowClass",$RowClass);  
		if($RowClass == "Row")  
		{  
		$highlight = "onmouseover='this.className=\"RowHL\"' onmouseout='this.className=\"Row\"'";   
		}  
		else  
		{  
		$highlight = "onmouseover='this.className=\"RowHL\"' onmouseout='this.className=\"AltRow\"'";  
		}   
		$Tpl->SetVar("highlight",$highlight);  
// -------------------------  
//End Custom Code  

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 01/31/2006, 2:32 AM

So now i wonder how to put all this into andaction, whenever needed to include just by selecting add action from IDE/GUI ...

:-)
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
Walter Kempees
Posted: 01/31/2006, 2:33 AM

don't we all ;-)

"feha" <feha@forum.codecharge> schreef in bericht
news:2543df3cb405c25@news.codecharge.com...
> So now i wonder how to put all this into andaction, whenever needed to
> include
> just by selecting add action from IDE/GUI ...
>
> :-)
> _________________
> Regards
> feha
> Vision.To Design
> www.vision.to
> wowdev.com
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

lvalverdeb

Posts: 299
Posted: 01/31/2006, 7:51 PM

Building on what Feha/Benjamin have contributed and since I use grids with/without Alternate rows, here's a function to implement highlight row/alternate rows functionality (or yet another way of skinning the same cat):

1) Create two label controls in the HTML view as follows:
  
<tr class="{RowClass}" {HighLight}>  

2) Place the following function in an includable location:
  
function highlightRow(&$rowClassControl,&$highLightControl,$myHighLightClass="") {  
	global $AltRow;  
	$useAltRows = strlen($myHighLightClass);  
	$RowClass = ($AltRow && $useAltRows) ? "AltRow":"Row";  
	$HighLightClass = ($useAltRows)? $myHighLightClass:"AltRow";  
	$rowClassControl->SetValue($RowClass);  
	$highLightControl->SetValue("onmouseover='this.className=\"$HighLightClass\"' onmouseout='this.className=\"$RowClass\"'");  
	$AltRow = ($useAltRows) ? (!$AltRow):0;  
}  
  

3) from the beforeshowrow:
  
highLightRow($form->RowClass,$form->HighLight);  // no Alternate rows  
or
  
highLightRow($form->RowClass,$form->HighLight,"yourHighlightClass"); // for alternate rows.  

Luis


_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
Walter Kempees
Posted: 02/01/2006, 1:39 AM

@feha
I responded with : Don't we all.
But checkout the tread I started with "Alternate Rows in grid, the easy way"
If you take a look at the latest additions to that thread it looks like we
are being heared and maybe served.

"feha" <feha@forum.codecharge> schreef in bericht
news:2543df3cb405c25@news.codecharge.com...
> So now i wonder how to put all this into andaction, whenever needed to
> include
> just by selecting add action from IDE/GUI ...
>
> :-)
> _________________
> Regards
> feha
> Vision.To Design
> www.vision.to
> wowdev.com
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

lvalverdeb

Posts: 299
Posted: 02/01/2006, 8:43 AM

Here is an improved and shorter version using $Tpl:
  
function highlightRow($myHighLightClass="",$useAltRows=false) {  
	global $AltRow,$Tpl;  
	$RowClass = ($AltRow && $useAltRows) ? "AltRow":"Row";  
	$HighLightClass = (strlen($myHighLightClass)) ? $myHighLightClass:"AltRow";	  
	$Tpl->SetVar("RowClass",$RowClass);  
	$Tpl->SetVar("HighLight","onmouseover='this.className=\"$HighLightClass\"' onmouseout='this.className=\"$RowClass\"'");  
	$AltRow = ($useAltRows) ? (!$AltRow):0;  
}  

This requires the Tpl custom vars {RowClass} and {HighLight}
  
<!-- BEGIN Row -->    
            <tr class="{RowClass}" {HighLight}>  
and produces the following results depending on how it is used:

highlightRow() // no alternate rows and uses AltRow style for highlighting
highlightRow("myHighLiteClass") // no alternate rows and uses your custom style for highlighting.
highlightRow("myHighLiteClass",true) // alternate rows with your custom style for highlighting
highlightRow("",true) // ugly and somewhat confusing since altrow style and highligh style are the same (not recommended).

Luis

_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
Benjamin Krajmalnik
Posted: 02/05/2006, 7:41 PM

Luis,

I initially did the same thing as you - created it as a function.
However, in my application I have an XP style tabbed interfac with multiple grids. Since you are using one global variable, it would be common to all of the grids, which would give ununiform behavior - some grids could start with the row class and others with the altroe class.

One solution would be to declare the global "AltRow" variables externally and pass their address to the different calls from the different grids.
Abs
Posted: 05/11/2006, 1:07 AM

HI,

Please can someone show example of highlighting row when a checkbox is checked. in .net pls.

Thanks

Abs
Abs
Posted: 05/12/2006, 5:51 AM

I managed to do it using javascript:

function highlightRow(tr, checkbox) {
while (tr.tagName.toUpperCase() != 'TR' && tr != null)
tr = tr.parentNode;

if (checkbox.checked == true)
tr.className="Checked";

if(checkbox.checked == false)
tr.className="Row";
}

but it resets when oage is posted back?

Can someone tell me how i can maintain the highlighted row when pages is posted back?


Thanks,

Abs

Add new topic Subscribe to topic   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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