rstaib / jquery-bootgrid

Nice, sleek and intuitive. A grid control especially designed for bootstrap.
http://www.jquery-bootgrid.com
MIT License
972 stars 364 forks source link

How to add footer row with total of products and sum of prices? #353

Open lenin77 opened 7 years ago

lenin77 commented 7 years ago

Hello I have a bootgrid table with some data like product, quantity, price and total, but I want to add a row at the final of the table including the sum of all total. Can you please tell me how to enable it?

This is my table structure:

<table id="employee_grid" class="table table-condensed table-hover table-striped table-responsive" cellspacing="0" data-toggle="bootgrid">
                                    <thead>
                                        <tr>
                                            <th data-column-id="cantidad" data-type="numeric" data-header_class="cantidad">Cantidad</th>
                                            <th data-column-id="nombre_producto" data-sortable="true"  data-header-css-class="nombre_producto" >Producto</th>
                                            <th data-column-id="precio" data-type="numeric" data-formatter="precio" data-align="right" data-header-align="right" data-sortable="true"  data-header-css-class="precio" >Precio</th>
                                            <th data-column-id="total" data-align="right" data-header-align="right" data-type="numeric" data-formatter="precio" data-header-css-class="total" >Total</th>
                                            <th data-column-id="descripcion" data-header-css-class="descripcion">Comentarios</th>
                                        </tr>
                                    </thead>
                                </table>

Thank you

andersonssa commented 7 years ago

Nobody got it? I'm going through the same problem.

bitsnaps commented 6 years ago

This may not be the best way but it works for me: https://stackoverflow.com/questions/43380631/bootgrid-sum-column-and-show-result-it-in-footer/48037261#48037261

zviredler commented 6 years ago

`ajaxSettings: { cache: false, }, responseHandler: function (response) {

        //Do what ever you want

        var total = response.total;

        return response;
    },`
KenpoJ commented 4 years ago

I can't find an answer to this issue either. Just looking to add a row at the bottom of the table that displays the sum of the columns above. Not sure if the responseHandler is what I'm looking for or not.