This discussion is archived
4 Replies Latest reply: Jan 25, 2013 12:28 AM by scott.wesley RSS

gNumRows removed from 4.2

scott.wesley Guru
Currently Being Moderated

I noticed the JavaScript variable gNumRows, formerly of apex_4_0.js, is no longer present in APEX 4.2.

Is there an equivalent?

For a classic report, I had a script modified as such to get around the problem.
var gNumRows = 50; // workaround for 4.2
// Loop through the number of rows in the table
for (i=1;i<=gNumRows;i++) { 
  if ($x(itm)) { // workaround for 4.2
} // end loop
  • 1. Re: gNumRows removed from 4.2
    Roel Oracle ACE Director
    Currently Being Moderated
    That's the punishment for using unsupported constructs ;-)

    Probably something like below might be a valid replacement:

    var gNumRows = $('table#report_' + <report ID> + <other selector to get to the right detail table> + ' tr').length
  • 2. Re: gNumRows removed from 4.2
    VC Guru
    Currently Being Moderated

    May be it was deprecated OR re-written who knows because its internal.

    $('#YOUR_REGION_STATIC_ID .report-standard>tbody>tr').length
    //you may need to replace report-standard with appropriate class used by your report template
  • 3. Re: gNumRows removed from 4.2
    flavioc Pro
    Currently Being Moderated
    I must be missing something here, I don't understand the meaning of gNumRows as you might have more than one report region in the same page.
    I'd say in such cases is much better to have a item (hidden or not) holding the number of the rows for a specific report and then refer to its value.

    But can you explain why you need gNumRows in the first place?

    Thank you


  • 4. Re: gNumRows removed from 4.2
    scott.wesley Guru
    Currently Being Moderated
    Thanks Roel, I'm not even sure where that was sourced.

    This worked in my scenario
    var gNumRows = $('#my_static_id tbody tr').length;  
    It is part of some code to loop through entries in a classic report with an editable qty field.

    A total is shown at the bottom. No doubt that could also be spruced up with some better jQuery


  • Correct Answers - 10 points
  • Helpful Answers - 5 points