We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Offline mode still not working after updated to 17.4.0.42/41

Thread ID:

Created:

Updated:

Platform:

Replies:

150461 Jan 8,2020 01:19 AM UTC Feb 4,2020 11:44 AM UTC Blazor 6
loading
Tags: Charts
Feifan
Asked On January 8, 2020 01:19 AM UTC

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?

Vignesh Natarajan [Syncfusion]
Replied On 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. 
 


Feifan
Replied On January 9, 2020 01:14 AM UTC

Hi Vignesh,

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

Vignesh Natarajan [Syncfusion]
Replied On 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.  
 


Feifan
Replied On 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

Srihari Muthukaruppan [Syncfusion]
Replied On January 13, 2020 03:21 AM UTC

Hi Feifan, 
  
  
  
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.

Srihari Muthukaruppan [Syncfusion]
Replied On 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 { getset; } = 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 { getset; }  
. . . . .   
    }      
}  

Screenshot: 
 

Kindly let us know if you have any concern.  

Regards  
Srihari M 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon