Solved

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

Posted on 2013-12-19
3
358 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now