[buddypress-trac] [BuddyPress] #2465: JQuery fix for proper alternate table row highlighting

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri Jun 25 15:29:30 UTC 2010


#2465: JQuery fix for proper alternate table row highlighting
-----------------------+----------------------------------------------------
 Reporter:  jeffsayre  |       Owner:                          
     Type:  defect     |      Status:  new                     
 Priority:  normal     |   Milestone:  1.2.5                   
Component:  Core       |    Keywords:  has-patch, needs-testing
-----------------------+----------------------------------------------------
 BuddyPress core's default theme has a simply JQuery script for providing
 alternate row highlighting of table rows, message inbox lists, and forum
 thread lists. However, this coding does not work properly for table rows.
 See attached screenshot One for visual explanation.

 Why is this the case? Because BuddyPress generates the settings form
 output from multiple screen files, each one creating a new outputted
 table. Using the "table tr" selector does not properly select rows for
 each table. This coding will find every-other table row in the entire
 document. It is not relative to a single table Therefore, if you have more
 than one table output on a screen, the alternate highlighting will start
 off on the wrong count for every other table as seen in the screenshot.

 How can this be fixed? By using the selector "tr:nth-child(even)". This
 will find every even table row relative to the table itself. See
 screenshot Two for corrected output.

 NOTE: The included patch assumes that the alternate rows to be highlighted
 should be the even rows. This could easily be switched to odd rows if
 preferred. I chose highlighting of even rows because I prefer to output
 table head selectors "<th></th>" and provide a different highlight color
 for the table headers. Therefore, the first table row (the first non-
 header row) will be white the next grey, the next white and so on. The
 header then would be a contrasting, non white or grey color. See
 screenshot Three.

-- 
Ticket URL: <http://trac.buddypress.org/ticket/2465>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list