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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error TypeError: this.model.currentViewData is undefined

Thread ID:

Created:

Updated:

Platform:

Replies:

132090 Aug 13,2017 04:50 PM UTC Aug 16,2017 04:23 AM UTC ASP.NET Core 3
loading
Tags: Grid
Stefano Capobianco
Asked On August 13, 2017 04:50 PM UTC

Hi, i'm using Syncfusion Grid Control with a WebApi.

In the Index.cshtml i use this code for the grid definition:


                    <ej-grid id="UsersGrid" datasource="ViewBag.datasource" allow-paging="true" locale="it-IT" action-failure="OnActionFailure">
                        <e-toolbar-settings show-toolbar="true" toolbar-items=@(new List<string>() {"excelExport","wordExport","pdfExport" })>

                        </e-toolbar-settings>
                        <e-page-settings page-size="2" enable-query-string="true"></e-page-settings>
                        <e-datamanager url="http://localhost:5110/api/countries" adaptor="WebApiAdaptor"></e-datamanager>
                        <e-columns>
                            <e-column field="Id" header-text="ID Nazione" text-align="Right" width="75"></e-column>
                            <e-column field="CountryName" header-text="Nazione" text-align="Right" width="75"></e-column>
                            <e-column field="IstatCode" header-text="Codice Isat" text-align="Right" width="75"></e-column>
                            <e-column field="IsoCode" header-text="Codice Iso" text-align="Right" width="75"></e-column>
                            <e-column field="StartDate" header-text="Data Inizio" text-align="Right" width="75"></e-column>
                            <e-column field="EndDate" header-text="Data Fine" text-align="Right" width="75"></e-column>
                        </e-columns>
                    </ej-grid>

This is the Web Api code :
        public object Get()
        {

            DataPage<Country> countries = null;

            using (var uow = _uowProvider.CreateUnitOfWork())
            {
                var repository = uow.GetRepository<Country>();
                var queryString = Request.Query;

                int skip = Convert.ToInt32(queryString["$skip"]);
                int take = Convert.ToInt32(queryString["$top"]);
                skip = skip > 0 ? skip : 1;
                
                countries = _pager.Get(skip, take);

                return new { Items = countries, Count = countries.TotalEntityCount };
            }


        } 

To manage the database access i use Digipolis.DataAccess, and Digipolis.DataAccess.Paging;

The result of this operation is Table empty and the browser console say : TypeError: this.model.currentViewData is undefined.

It's all correct ?
Thanks in advance
Stefano

Venkatesh Ayothi Raman [Syncfusion]
Replied On August 14, 2017 12:41 PM UTC

Hi Stefano, 

Thanks for contacting Syncfusion support. 

We were unable to reproduced the reported issue at our end and we have prepared a sample for your reference which can be download from following link, 
Note: In that sample, we have rendered the Grid using Web API service which is replicates your code example. 

This issue was reproduced when the grid model value is undefined/null. We suspect that you are destroying the Grid model in any case or scenario. If so, provide more details about that as well as could you please share the following details? 
1)      Share the screenshot of issue with expanded details. 
2)      screenshot of network tab while response from server side. 
3)       Scenario for replication procedure. 
4)      Show the first record data details. 
It would be helpful for us to find the problem and provide the better solution as earliest. 

Regards, 
Venkatesh Ayothiraman. 


Stefano Capobianco
Replied On August 15, 2017 08:18 AM UTC

Dear support thx for your help. With your sample i've found the problem. Normally i use in startup.cs the follow mvc initializer:             

services.AddMvc()

                .AddJsonOptions(opts =>

                {

                    // Force Camel Case to JSON

                    opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

                    opts.SerializerSettings.ReferenceLoopHandling =

                               Newtonsoft.Json.ReferenceLoopHandling.Ignore;

                });

The problem was items and not Items according the documentation.

Thx for your help

Stefano Capobianco


Venkatesh Ayothi Raman [Syncfusion]
Replied On August 16, 2017 04:23 AM UTC

Hi Stefano, 

Thanks for the update. 

We are very happy to hear that your requirement is achieved. 

Regards, 
Venkatesh Ayothiraman. 


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.

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

;