Hello Syncfusion Team, I have a Grid with Odata V4 Adapter and I have a problem with Date Time because Grid internally changes the date time to fit Utc and I can´t Manage it in Database.
Here An example If I filter date to 01/04/2022 dd/MM/yyyy format , because browser is in UTC +2 the internal query gets converted date equal 31/03/2022 22:00 hh Utc 0 and that´s a problem with the client Database that stores all data in UTC 0 independant on browser time zone.
How could achieve this?
Thanks in advance
Héctor
Hi Hector,
Greetings from Syncfusion support.
We are checking the reported problem from our side. We will update you further details within two business days. Until then we appreciate your patience.
Regards,
Renjith R
Hi Hector,
We suggest you to override the ProcessQuery method of ODataV4Adaptor class to achieve this requirement. Inside this ProcessQuery method we suggest you to fetch the date filtering predicate and modify the date value using its local time. Now the entered date value in filter bar textbox will be send in the request also.
Please refer and use as like the code below,
|
<SfGrid @ref="Grid" Height="100%" Width="100%" ...> ... <SfDataManager @ref="DataManagerRef" Url="/weatherforecast" CrossDomain="true" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager> </SfGrid>
@code { SfGrid<WeatherForecast> Grid; public static SfDataManager DataManagerRef { get; set; } protected override void OnAfterRender(bool firstRender) { if (firstRender) { DataManagerRef.DataAdaptor = new NewODataClass(DataManagerRef); } base.OnAfterRender(firstRender); } public class NewODataClass : ODataV4Adaptor { public NewODataClass(DataManager dm) : base(dm) { } public override object ProcessQuery(DataManagerRequest queries) {
if (queries.Where != null && queries.Where[0].predicates != null) { queries.Where[0].predicates[0].value = Convert.ToDateTime(queries.Where[0].predicates[0].value).ToLocalTime(); } var ActualReturnValue = base.ProcessQuery(queries); return ActualReturnValue; } }
}
|
Please check the above suggestion and try this from your side.
Regards,
Renjith R
Thank you so much, was not my problem, but with this tip I Have managed to fix my problems.
really appreciate and best regards
Hi Hector,
Thanks for the update. We are glad to hear that you have resolved your query.
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan