4 Replies Latest reply: Jan 25, 2013 2:28 AM by scott.wesley RSS

    gNumRows removed from 4.2

    scott.wesley
      Hi,

      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
      Scott
        • 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
            VC
            Scott,

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

            Try
            $('#YOUR_REGION_STATIC_ID .report-standard>tbody>tr').length
            //you may need to replace report-standard with appropriate class used by your report template
            Vikram
            • 3. Re: gNumRows removed from 4.2
              flavioc
              Scott,
              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

              Flavio

              ----
              http://oraclequirks.blogspot.com
              http://www.yocoya.com
              • 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