Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

$4.95 Windows Hosting at Webhost4life.com
  Ads  
Aspose - The .NET & Java component publisher
 


  Sponsors  

Meet Our Sponsors

.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  Repository Modu...  Alternating Style for entries?
Previous Previous
 
Next Next
New Post 4/20/2008 6:35 AM
User is offline Thomas Jachmann
27 posts
10th Ranked


Alternating Style for entries? 

Is there a chance to have an alternating style for the entries (e.g. different background for better seperation?

Best regards

Tom

 
New Post 4/20/2008 7:57 AM
User is offline Steve Fabian
1498 posts
6th Ranked








Re: Alternating Style for entries? 

there's no built-in way to do that, but since all the output is generated by templates, you could implement row coloring logic in some javascript and add the javascript to your template.

BIG DISCLAIMER: I haven't tried this, but it *should* work  :)

search the internet for, or write,  a javascript function that will do the following...

1. find your table
2. iterate through the rows
3. set the class for each row based on whether it's an odd or even row

and obviously have 2 classes defined, one for even rows and one for odd rows

you would place that function in the header.html or footer.html template file. You might have to place it in the footer file so that the table which is dynamically created exists in the dom when the function is executed.

If you have any problems, let me know and I can look into it further.

 


Steve Fabian
Gooddogs.com
Sit, Stay, Code ... Good boy!
 
New Post 4/20/2008 8:05 AM
User is offline Steve Fabian
1498 posts
6th Ranked








Re: Alternating Style for entries? 
Modified By Steve Fabian  on 4/20/2008 10:06:06 AM)

took a quick look .. and found this script which looks like what I was talking about

if(document.getElementsByTagName){ 
   var table = document.getElementById(tableid);  
   var rows = table.getElementsByTagName("tr");  
   for(i = 0; i < rows.length; i++){          
     if(i % 2 == 0){
       rows[i].className = "color_one";
     }else{
       rows[i].className = "color_two";
     }      
   } 
}

Steve Fabian
Gooddogs.com
Sit, Stay, Code ... Good boy!
 
New Post 7/1/2008 1:21 PM
User is offline Thomas Bosscher
30 posts
www.stymies.net
10th Ranked


Re: Alternating Style for entries? 

Has anyone successfully implemented an alternating row color in the repositry module? If so, would you be willing to show your secrets? I am trying to find a solution that will work with the repository module and allow alternating rows wihtin the dashboard. If I find anything I will post my findings.


 
New Post 7/2/2008 7:28 AM
User is offline Thomas Bosscher
30 posts
www.stymies.net
10th Ranked


Re: Alternating Style for entries? 

Here is what I have so far but have been unable to make this work. I guess I do not understand enough how the dashboard module populates the table rows. Any help would be great.

I placed the following javascript in the "header" textbox of the module settings:

<style>
 .odd{background-color: white;}
 .even{background-color: gray;}
</style>

<script>
function alternate(id){
 if(document.getElementsByTagName){ 
   var table = document.getElementById(id);  
   var rows = table.getElementsByTagName("tr");  
   for(i = 0; i < rows.length; i++){          
 //manipulate rows
     if(i % 2 == 0){
       rows[i].className = "even";
     }else{
       rows[i].className = "odd";
     }      
   }
 }
}

</script>

This is the dashboard ratings template:

<TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDERWIDTH="0" ID="AltRows">
  <TR WIDTH="100%" style="padding-bottom: 3px;">
    <TD ALIGN="Left" WIDTH="75%" VALIGN="Middle">[FILENAME]</TD>
    <TD ALIGN="Right" WIDTH="25%" VALIGN="Middle">[RATING]</TD>
  </TR>
</TABLE>

This is the code that I placed in the "footer" textbox of the module settings:

<script>
window.onload = alternate("AltRows");
</script>

Unfortunately I can only get the first row to change color and every row after that is the same. DOes anyone know enough about how the dashboard module renders a table and can maybe explain what needs to be done to make this script work?

Thanks in advance, I will keep trying.

Tom


 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  Repository Modu...  Alternating Style for entries?
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


AfterImage Internet Consulting and SEO Services
AfterImage provides search engine optimization (SEO), Internet consulting and hosting services for the Windows platform (IIS, ASP, SQL Server).
www.afterimage.nl/
Alki Homes - Seattle, WA
Exemplary service for your Seattle Real Estate needs. It's what you deserve from your Realtor®!
www.alkihomes.com
Swanzey Internet Group LLC
DotNetNuke design, development, e-Commerce, hosting, maintenance, and training. Exclusively DotNetNuke.
www.swanzey.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP