Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2366

How should i have dropdown , file exporters and sum in all for one datatable.

$
0
0
        $(document).ready(function () {


            $('#<%=GridView1.ClientID%>').DataTable({
                 "footerCallback": function (row, data, start, end, display) {
                  var api = this.api();
                // Remove the formatting to get integer data for summation
                        var intVal = function (i) {
                            return typeof i === 'string' ?
                                i.replace(/[\$,]/g, '') * 1 :
                                typeof i === 'number' ?
                                    i : 0;
                        };

                            // Total over all pages
                            total6 = api
                                .column(6)
                                .data()
                                .reduce(function (c, d) {
                                    return intVal(c) + intVal(d);
                                }, 0);

                    pageTotal6 = api
                        .column(6, { page: 'current' })
                        .data()
                        .reduce(function (c, d) {
                            return intVal(c) + intVal(d);
                        }, 0);


                    $(api.column(6).footer()).html(
                        'Current/Total  : ' + pageTotal6 + '/' + total6
                    );


                            total = api
                            .column(7)
                            .data()
                            .reduce(function (a, b) {
                            return intVal(a) + intVal(b);
                            }, 0);


                            // Total over this page
                            pageTotal = api
                                .column(7, { page: 'current' })
                                .data()
                                .reduce(function (a, b) {
                                    return intVal(a) + intVal(b);
                                }, 0);

                            // Update footer
                            $(api.column(7).footer()).html(
                                'Current/Total  : ' + pageTotal + '/' + total 
                            );
                }








            });




        });

        $(document).ready(function () {
            $('#<%=GridView1.ClientID%>').DataTable({

                dom: 'Bfrtip',
                buttons: [
                    'copy', 'csv', 'excel', 'pdf', 'print'
                ]

            });
        });

Viewing all articles
Browse latest Browse all 2366

Trending Articles