Hi Stephen,
You can use the queryCellInfo event of the Grid to modify any cells in the Grid. Therefore, for a null date values, you can use the queryCellInfo event and format the cells.
Based on the type of the column and values present in the current cell, text of the particular has been replaced. Refer to the following code example and API Reference.
<div id="Grid"></div> <script type="text/javascript"> $(function () { var data = [ { OrderID: 10248, OrderDate: new Date() }, { OrderID: 10249, OrderDate: null }, { OrderID: 10250, OrderDate: "" } ] $("#Grid").ejGrid({ dataSource: data, allowPaging: true, queryCellInfo: function (args) { if (args.column.type == "date" || args.column.type == "datetime") { var val = ej.getObject(args.column.field, args.data); if (ej.isNullOrUndefined(val) || val == "") $(args.cell).text("No Date Supplied"); } }, columns: [ { field: "OrderID" }, { field: "OrderDate", format: "{0:MM/dd/yyyy}" } ], }); }); </script> |
We have prepared a sample that can be referred from the following jsPlayground.
Regards,
Seeni Sakthi Kumar S.