Hi Gabor,
Thanks for contacting Syncfusion Support.
Query#:- I would like the grid do not touch the datetimes at all, I would like to display them in UTC (or untouched) regardless of any browser timezone
We have achieved your requirement “display date in UTC format without any browser timeZone” using CustomAdaptor by extending the UrlAdaptor on load event and convert the date value to UTC before binding value into the Grid in the processResponse method.
Please refer to the code example:-
<ej-grid id="FlatGrid" allow-paging="true" load="load">
<e-datamanager url="/Home/DataSource" adaptor="UrlAdaptor"></e-datamanager>
<e-columns>
<e-column field="OrderID" header-text="Order ID" text-align="Right" is-primary-key="true"></e-column>
. . .
</e-columns>
</ej-grid>
<script>
function load(args) {
this.model.dataSource.adaptor = new customadaptor();
}
var customadaptor = new ej.UrlAdaptor().extend({
processResponse: function (data, ds, query, xhr, request, changes) {
var res = JSON.parse(xhr.responseText);
for (var i = 0; i < res.result.length; i++) {
var date = res.result[i].Date.split("(")[1].split(")")[0]; // use your date column field name
value = new Date(parseInt(date)).toUTCString()
data.result[i].Date = value;
}
return this.base.processResponse.apply(this, [data, ds, query, xhr, request, changes]);
}
});
</script> |
Please get back to us if you need any further assistance.
Regards,
Farveen sulthana T