Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calculate total of a column when check box is checked in tabular form

user4395560Jun 25 2014 — edited Jun 27 2014

Hello,

I have a tabular form using check boxes to select a row.  When a user selects a checkbox, the value from another column updates a page item.  For example, the application has several columns displaying data.  One of the columns is a piece count for the widget being displayed in that row.  When a user selects one of the check boxes, the piece count value for that row is displayed in a page item to show a total.  This is necessary because as the user continues to select more rows, the page item continues to add the piece counts for each row in the page item.  As the row is unselected, the total would be subtracted.  I've accomplished that with the code below where SELECT_TOTAL is my page item:

<script language="JavaScript" type="text/javascript">

   var total = 0;

   $(document).ready( function(){

      $('input[name=f01]').change( function(){

         if ( $(this).is(':checked') ){

            amt = $(this).parents('tr:first').children('td').find('input[name=f05]').val()

            // alert('changed');

            total += parseFloat(amt);

         $s('SELECT_TOTAL',total);

         }

         else{

            amt = $(this).parents('tr:first').children('td').find('input[name=f05]').val()

            // alert('not changed');

            total -= parseFloat(amt);

            $s('SELECT_TOTAL',total);

         }

      });

   });

</script>

My issue is that I can't seem to find a solution for when the user selects the select all check box that was created when the tabular form was built.  If the user clicks on the select all check box, all rows become checked but my page item is not updated with the values for each row.  Any help determining how to accomplish would be appreciated.

I am using Apex 4.0.2 on an 11g Oracle database

Regards, Max

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 25 2014
Added on Jun 25 2014
3 comments
2,227 views