rowGroup works locally but not when published

rowGroup works locally but not when published

LTechLTech Posts: 2Questions: 1Answers: 0

using MVC .net V4.8 and bootstrap 4.5.3, datatables 1.10.15

The data loads and the code in the initComplete and after the table (to add a print button) runs, but the rowGroup code js debug breakpoint is never hit on the server like it it locally.

I just need to know which of the .js and .css files i may be missing when i bundle them during the publish process. Here's what I have:

            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/bootstrap.bundle.js"));

            bundles.Add(new ScriptBundle("~/bundles/customjs").Include(
                        "~/Scripts/Custom/universal.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css"));

            bundles.Add(new ScriptBundle("~/bundles/datatables").Include(
                    "~/Scripts/DataTables/jquery.dataTables.js",
                    "~/Scripts/DataTables/dataTables.bootstrap4.js",
                     "~/Scripts/DataTables/dataTables.fixedHeader.js",
                     "~/Scripts/DataTables/dataTables.rowGroup.js",
                    "~/Scripts/DataTables/dataTables.buttons.js",
                    "~/Scripts/DataTables/buttons.bootstrap4.js",
                    "~/Scripts/DataTables/buttons.print.js",
                    "~/Scripts/DataTables/dataTables.select.js"));

            //main datatable css + css for pieces used
            bundles.Add(new StyleBundle("~/Content/datatablesCss").Include(
                      "~/Content/DataTables/css/dataTables.bootstrap4.css", 
                      "~/Content/DataTables/css/fixedHeader.bootstrap4.css",
                      "~/Content/DataTables/css/rowGroup.bootstrap4.css",
                      "~/Content/DataTables/css/buttons.bootstrap4.css",
                      "~/Content/DataTables/css/select.bootstrap4.css"));

Here is how I use the rowGroup on the table:

             rowGroup: {
                 startRender: null,
                 endRender: function (rows, group) {

                     // converting to integer to find total
                     var intVal = function (i) {
                         return typeof i === 'string' ?
                             i.replace(/[\$,]/g, '') * 1 :
                             typeof i === 'number' ?
                                 i : 0;
                     };

                     //col without formating or div in it - just raw#
                     var totCommission = rows
                         .data()
                         .pluck(7)  //col just for totals
                         .reduce(function (a, b) {
                             return intVal(a) + intVal(b);
                         }, 0);
                     totCommission = $.fn.dataTable.render.number(',', '.', 2, '$').display(totCommission);

                     return $('<tr style="background-color:lightgrey" />')
                         .append('<td colspan="3">(Totals for displayed data only)</td>')
                         .append('<td colspan="3"><div class="float-right">Total Commission for ' + group + '</div></td>')
                         .append('<td><div class="float-right">' + totCommission + '</div></td>');
                 },
                 dataSrc: [1]  //order# grouping

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 54,716Questions: 1Answers: 8,560 Site admin
    Answer ✓

    If you could link to your page that would allow us to debug it.

    What you show above appears to be okay. Maybe the debugger will indicate if one of the libraries isn't loading correctly?

    Allan

  • LTechLTech Posts: 2Questions: 1Answers: 0

    I figured it out. Even though that version of datatables.net HAS a rowGroup.min.js file it is EMPTY. Exclude or delete it and it works.

Sign In or Register to comment.