Solved

Need to find a row then highlight the row that is after the found row

Posted on 2013-12-19
3
362 Views
Last Modified: 2013-12-19
Hi,
I need to find "Grand Total" in the below HTML and then change the background-color of the 3rd row or the row that has a cell with the class="apexir_AGGREGATE_VALUE"

I have tried:
$('span.apex_break_headers:contains("Grand Total")') and added .parent() or .closet('tr')
but doesn't work.

<tr><th colspan="3" class="apexir_REPEAT_HEADING" id="BREAK_ORGANIZATION_5">Organization : <span class="apex_break_headers"><!--1-->Grand Total</span>
    </th>
</tr>
<tr><th id="CUSTOMER"><div style="text-align:center;">Customer</div></th>
    <th id="REVENUE"><div style="text-align:center;">Revenue</div></th>
</tr>
<tr class="odd">
  <td  align="left" headers="CUSTOMER BREAK_ORGANIZATION_5">Total
  </td>
  <td  align="right" headers="REVENUE BREAK_ORGANIZATION_5">
    <a href="f?p=888:48:8976543071158::NO:48:P48_PA_PERIOD_NAME,P48_P_PERIOD_NAME,P48_P_ORG_ID,P48_PREV_GL_PERIOD_NAME,P48_CUSTOMER,P48_ORGANIZATION,P48_COLUMN:13-Oct-WK4,OCT-13,81,DEC-12,Total,,REVENUE" >$431,060.34</a>
  </td>
</tr>
<tr >
  <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="CUSTOMER BREAK_ORGANIZATION_5">
  </td>
  <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="right" headers="REVENUE BREAK_ORGANIZATION_5">$431,084,060.34<br />
  </td>
</tr>

Open in new window



others have same structure for subtotals so I need to zero in on the Grand Total span.

<tr><th colspan="3" class="apexir_REPEAT_HEADING" id="BREAK_ORGANIZATION_1">Organization : <span class="apex_break_headers"><!--0-->This Company</span></th></tr>

Open in new window

0
Comment
Question by:bcarlis
3 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 250 total points
ID: 39730691
Hi,
something like this?
http://jsfiddle.net/EE_RainerJ/QQ2Q7/

$('span.apex_break_headers:contains("Grand Total")').parents('tr').next().next().next().css( "background-color","red");

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 39730695
I don't follow you : http://jsfiddle.net/mFZ3Z/1/
var $Grand_Total_row = $('span.apex_break_headers:contains("Grand Total")').closest("tr");
$Grand_Total_row.css("backgroundColor", "yellow");

Open in new window

0
 
LVL 2

Author Comment

by:bcarlis
ID: 39730747
Awesome! The first one got the row, and I just needed to add .children (which Tony Miller had in the original code)

$('span.apex_break_headers:contains("Grand Total")').parents('tr').next().next().next().children().css( "background-color","red");

Open in new window

0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question