Offline mode still not working after updated to 17.4.0.42/41
Hi team,
The offline mode of DataManager component is still not working.
If I go with
<EjsDataManager Url="@url" Adaptor="Adaptors.WebApiAdaptor" Offline="false" ></EjsDataManager>
the grid will be fulfilled, but If I switch to
<EjsDataManager Url="@url" Adaptor="Adaptors.WebApiAdaptor" Offline="true" ></EjsDataManager>
the grid will render "no records to display"
Could you please have a look into it?
SIGN IN To post a reply.
6 Replies
VN
Vignesh Natarajan
Syncfusion Team
January 8, 2020 08:43 AM UTC
Hi Feifan,
Greetings from Syncfusion support.
Query: “The offline mode of DataManager component is still not working. ”
To validate the reported issue, we have prepared a WebAPI Adaptor sample with Offline property of DataManager in our latest version 17.4.0.42. We are not able to reproduce the reported issue at our end. Kindly download the sample from below
To ensure that the reported issue in fixed our latest version (17.4.0.42), we have downgraded the above sample to 17.4.0.40 version and issue is reproduced. Kindly ensure that you have referred the same version of script files and Nuget package. Refer our UG documentation to upgrade to our latest version.
If you are still facing the issue, kindly get back to us along with issue reproducible sample.
Regards,
Vignesh Natarajan.
FE
Feifan
January 9, 2020 01:14 AM UTC
Hi Vignesh,
Attachment: WebAPI_358217b.zip
I've tried your code, it surely works. but I'm using json-server to mock data, and that's when it breaks.
Could you try my code and you will see what I'm talking about. The offline mode works fine at 17.3.0.29beta, although just with grid, no working well with chart.
Regards,
Feifan
Attachment: WebAPI_358217b.zip
VN
Vignesh Natarajan
Syncfusion Team
January 9, 2020 06:17 AM UTC
Thanks for the update.
We are able to reproduce the issue in the provided sample. By default from our 17.4.0.39 release, for WebAPI adaptor data must be returned in form of Items and Count. Count must be returned from server if and only if RequiresCount ($inlinecount) is sent in query string, other wise json string must be returned from server.
Please find the release notes regarding the same from below
While using Offline property of DataManager, only default url will be sent to server without RequiresCount. In your json server (db), you have returned the value in form of items and count irrespective of querystring (requirescount). Hence the reported issue occur. So kindly modify your server only to return the Count only if RequiresCount sent in querystring.
For your convenience we have added routing file to your db.json (json server) and modified your json file to bind data to Grid when using both type of adaptors (with and without offline property). Refer the below code example.
[routes.json]
|
{
"/accruals/*": "/$1",
"/accruals?$inlinecount=allpages": "/accrualswithcount"
}
|
[db.json]
|
{
"accruals": [
{
"NMI": "1234567890",
. . .
},
{
"NMI": "2265786901",
. .
}
],
"accrualswithcount":{
"Items": [
{
"NMI": "1234567890",
"Site": "Airport",
. . . . .. . .
},
{
"NMI": "2265786901",
. . . . .
}
],
"Count": 2
}
}
|
Kindly download the modified sample from below
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan.
FE
Feifan
January 10, 2020 02:38 AM UTC
Hi Vignesh,
Thank you for your reply. Your solution works great with Grid component, however, with Charts component it will throw error
System.InvalidCastException: Unable to cast object of type 'System.Net.Http.HttpResponseMessage' to type 'System.Collections.IEnumerable'
Is that because dataManager of Charts only accept {"items":[{}{}{}],"count":number} format ? I remember in 17.3.0.29 Charts can only resolve {"result":[{}{}{}], "count":number} format
Regards
SM
Srihari Muthukaruppan
Syncfusion Team
January 13, 2020 03:21 AM UTC
Hi Feifan,
We have analyzed your query. From that, We would like to let you know that the chart is working fine in offline mode. But while using query to filter the data chart is not rendered properly. We confirm this as a bug and logged a defect report. You can keep track of the bug from the feedback portal below.
Feedback Link: https://www.syncfusion.com/feedback/11243/offline-mode-still-not-working-after-updated
The fix will be available in our weekly patch release which is scheduled to be rolled out on or before January 28th, 2019.
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.
Thanks,
Srihari.
SM
Srihari Muthukaruppan
Syncfusion Team
February 4, 2020 11:44 AM UTC
Hi Feifan,
In our 2019 Volume 4 release we have some breaking changes along with breaking issues (which is resolved in successive release) in our DataManager components. So the DataManager requires a Generic TValue to process or serialize the data in our latest source, hence the reported issue is occurred while using Query property with Offline property. To overcome this issue we have provided the solution in sample level. In which we have define the DataManager externally and processed the data based on the TValue in OnAfterRenderAsync() method and also the offline mode is set to true. Please find the below sample, screenshot and code snippet.
Code snippet:
|
<EjsDataManager @ref="DataManager" Url="https://mvc.syncfusion.com/Services/Northwnd.svc/Tasks/" Offline="true"></EjsDataManager>
<EjsChart DataSource="DataSource" id="container1">
<ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries Type="ChartSeriesType.Column" XName="Assignee" YName="Estimate" Query="@QueryData">
</ChartSeries>
</ChartSeriesCollection>
</EjsChart>
<EjsButton OnClick="@ChangeQuery">Change Query</EjsButton>
@code{
EjsDataManager DataManager;
public IEnumerable<Order> DataSource { get; set; } = new List<Order>();
public ChartSeries DefaultChartSeries = new ChartSeries();
public string QueryData = "new ej.data.Query().take(5).where('Estimate', 'lessThan', 1.5, false)";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{ //provide generic type TValue
object data = await DataManager.ExecuteQuery<Order>(new Query());
DataSource = (data as IEnumerable).Cast<Order>().ToList();
StateHasChanged();
}
}
public class Order
{
public int? Id { get; set; }
. . . . .
}
} |
Screenshot:
Kindly let us know if you have any concern.
Regards
Srihari M
SIGN IN To post a reply.
- 6 Replies
- 3 Participants
-
FE Feifan
- Jan 8, 2020 01:19 AM UTC
- Feb 4, 2020 11:44 AM UTC