JSFiddle - React, Tailwind, and code Playground

by dkamburov

HTML

<script src="https://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/2021.1/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/2021.1/latest/js/infragistics.lob.js"></script>
<script src="https://igniteui.github.io/help-samples/data-files/adventureworks.min.js"></script>
<link href="https://cdn-na.infragistics.com/igniteui/2021.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet">
<link href="https://cdn-na.infragistics.com/igniteui/2021.1/latest/css/structure/infragistics.css" rel="stylesheet">
<table id="grid"></table>

JavaScript

$(function () {
    $("#grid").igGrid({
        autoGenerateColumns: false,
        width: "100%",
        height: "400px",
        columns: [
            { headerText: "Product ID", key: "ProductID", dataType: "number", width: "25%" },
            { headerText: "Product Name", key: "Name", dataType: "string", width: "30%" },
            { headerText: "Product Number", key: "ProductNumber", dataType: "string", width: "20%" },
            { headerText: "Make Flag", key: "MakeFlag", dataType: "bool", width: "25%" }
        ],
        dataSource: adventureWorks,
        features: [
            {
                name: "Summaries",
                columnSettings: [
                    {
                        columnKey: "MakeFlag",
                        summaryOperands: [
                            {
                                rowDisplayLabel: "<span>Count True Values</span>",
                                type: "custom1",
                                summaryCalculator: $.proxy(countTrueValues, this),
                                order: 5
                            },
                            {
                                rowDisplayLabel: "Count False Values",
                                type: "custom2",
                                summaryCalculator: $.proxy(countFalseValues, this),
                                order: 6
                            }
                        ]
                    }
                ]
            }
        ]
    });
});

function countTrueValues(data) {
    var i, l = data.length, count = 0, elem;
    for (i = 0; i < l; i++) {
        elem = data[i];
        if (elem === true) {
            count++;
        }
    }
    return "<span styles='color:red;'>" + count + "</span>";
}

function countFalseValues(data) {
    var i, l = data.length, count = 0, elem;
    for (i = 0; i < l; i++) {
        elem = data[i];
        if (elem === false) {
            count++;
        }
    }
    return count;
}