Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryAlternating Style for entries?Alternating Style for entries?
Previous
 
Next
New Post
4/20/2008 8:35 AM
 

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 9:57 AM
 

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.

 

 
New Post
4/20/2008 10:05 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";
     }      
   } 
}
 
New Post
7/1/2008 3:21 PM
 

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 9:28 AM
 

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
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryAlternating Style for entries?Alternating Style for entries?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out