igGrid with datepicker editor for a date column

by georgianastasov

HTML

<script src="https://igniteui.com/js/modernizr.min.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/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.lob.js"></script>
<script src="https://igniteui.com/data-files/adventureworks.min.js"></script>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet"></link>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/structure/infragistics.css" rel="stylesheet"></link>

<table id="grid"></table>

JavaScript

$(function () {
            var data = [
                { OrderID: 1, OrderDate: new Date(2021, 0, 1), CustomerID: "ALFKI", ShipAddress: "Address 1", TotalItems: 10, TotalPrice: 100 },
                { OrderID: 2, OrderDate: new Date(2021, 1, 2), CustomerID: "BONAP", ShipAddress: "Address 2", TotalItems: 20, TotalPrice: 200 }
            ];

            $("#grid").igGrid({
                width: "100%",
                height: "500px",
                autoGenerateColumns: false,
                primaryKey: "OrderID",
                dataSource: data,
                columns: [
                    { headerText: "Order ID", key: "OrderID", width: "10%" },
                    { headerText: "Order Date", key: "OrderDate", width: "15%", dataType: "date" },
                    { headerText: "Customer ID", key: "CustomerID", width: "20%" },
                    { headerText: "Ship Address", key: "ShipAddress", width: "25%" },
                    { headerText: "Total Items", key: "TotalItems", width: "10%" },
                    { headerText: "Total Price", key: "TotalPrice", width: "15%", dataType: "number", format: "currency" }
                ],
                features: [
                    {
                        name: "Updating",
                        editMode: "row",          
                        enableAddRow: true,       
                        enableDeleteRow: true,    
                        columnSettings: [
                            { columnKey: "OrderID", readOnly: true },
                            { columnKey: "OrderDate", editorType: "datepicker", required: true },
                            { columnKey: "CustomerID", required: true },
                            { columnKey: "Ship Address", required: true },
                            { columnKey: "TotalItems", required: true },
                            { columnKey: "TotalPrice", required: true, editorType: "numeric", editorOptions: { format: "currency" } }
                        ]
 ...