4 Replies Latest reply on Jan 25, 2013 8:28 AM by Scott Wesley

    gNumRows removed from 4.2

    Scott Wesley

      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 Hartman
          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

            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
            1 person found this helpful
            • 3. Re: gNumRows removed from 4.2
              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
                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