TOPIC:

Formatting and Totals Row 9 months 1 day ago #238961

  • Topic Author
  • hambakwe
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 54
  • Thanks: 0
I've managed to set up a summary list view for a mysql table which gets populated successfully from entries on a Breezing Form.

I wish to achieve three additional things with the list:

1) I want to total the 8th, 9th and 10th columns to a generated total row at the bottom. I've found an example on the forum for a single column and changed it but I'm getting a strange result.

2) I want the totals row to be formatted with ',' separators and have 2 decimal places, I can achieve this in the columns with <?php $value = number_format($value , 2); ?> in 'item wrap' but it does not show in the total row.

The code I'm using for the totals is:

<?php echo '
<script>
jQuery( document ).ready(function() { jQuery("#myTestRow").remove();
var sum = 0; var broj = 0;
jQuery("tbody tr td:nth-child(10)").each(function () { broj = jQuery(this).text();
sum += Number(broj); });
jQuery( "tbody tr:last" ).after("<tr id=\"myTestRow\">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td> "+ sum +"</td>
<td>"+ sum +"</td>
<td>"+ sum +"</td>
<td></td>
</tr>");
});
</script>'; ?>

3) Lastly I'd like the figures to be right justified.

Attached image shows current output.

All help welcome, thanks.
Attachments:

Please Log in or Create an account to join the conversation.

Formatting and Totals Row 8 months 3 weeks ago #239133

  • Topic Author
  • hambakwe
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 54
  • Thanks: 0
Any help or suggestions welcome. Thanks

Please Log in or Create an account to join the conversation.

Formatting and Totals Row 2 months 6 days ago #245571

  • Topic Author
  • hambakwe
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 54
  • Thanks: 0
Great, Crosstec seems to be operating again. Can someone please comment further on this please?

Please Log in or Create an account to join the conversation.

Formatting and Totals Row 2 months 5 days ago #245585

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 801
Hi,

do you have a link to the list? Would make it easier for me to try it out with the Chrome developer tools as this will require pure javascript solution (also for formatting).

Good idea btw to use js for summaries in tables!

Regards,
Markus

Please Log in or Create an account to join the conversation.

Formatting and Totals Row 2 months 5 days ago #245586

  • Topic Author
  • hambakwe
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 54
  • Thanks: 0
Thanks for getting in touch Marcus. List link here: www.proliquidity.com/fund-clients

I can give you back end access as well if you need.

Best,
Martin

Please Log in or Create an account to join the conversation.

Formatting and Totals Row 2 months 4 days ago #245600

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 801
Hi,

please try this:
jQuery( document ).ready(function() { 
        
        jQuery("#myTestRow").remove();
        
        var sum = 0; 
        var sum2 = 0; 
        var sum3 = 0; 
        var broj = 0;

        jQuery("tbody tr td:nth-child(8)").each(function ()                 { 
            broj = jQuery(this).text();
            console.log(broj);
            sum += Number(broj); 
        });
        
        jQuery("tbody tr td:nth-child(9)").each(function ()                 { 
            broj = jQuery(this).text();
            console.log(broj);
            sum2 += Number(broj); 
        });

        jQuery("tbody tr td:nth-child(10)").each(function () { 
            broj = jQuery(this).text();
            console.log(broj);
            sum3 += Number(broj); 
        });
        
        jQuery( "tbody tr:last" ).after('<tr id="myTestRow">'+
            '<td></td>' + 
            '<td></td>' +
            '<td></td>' +
            '<td></td>' +
            '<td></td>' +
            '<td></td>' +
            '<td></td>' +
            '<td>' + sum.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") +'</td>' +
            '<td>' + sum2.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") +'</td>' +
            '<td>' + sum3.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") +'</td>' +
            '<td></td>' +
            '</tr>');
    });

Attachments:

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.131 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!