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

Self Referencing Loop

Thread ID:

Created:

Updated:

Platform:

Replies:

147318 Sep 5,2019 07:04 PM UTC Sep 12,2019 07:35 AM UTC ASP.NET Core - EJ 2 8
loading
Tags: DataGrid
Brad Shannon
Asked On September 5, 2019 07:04 PM UTC

I'm getting a self referencing loop error when I try to load my model into the Grid.  I tried adding the following line in my Startup.cs, but I'm still seeing the error.  How can I tell it to ignore this?

options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

Pavithra Subramaniyam [Syncfusion]
Replied On September 6, 2019 09:14 AM UTC

Hi Brad, 
Greetings from Syncfusion,

Currently we do not have support to achieve your requirement “Serialization support for dataSource object in ASP.NET Core “ but we have logged a feature request on this and it can be tracked through our feedback portal below.

Link : https://www.syncfusion.com/feedback/6417/serialization-support-for-datasource-object-in-asp-net-core  

If you have any more specification/suggestions to the feature request you can add it as a comment in the above portal.
 
 
Regards, 
Pavithra S 


Brad Shannon
Replied On September 6, 2019 11:02 AM UTC

Thanks for the heads up on that.  Now I'm trying to get the UrlAdaptor to work and it isn't populating...

<ejs-grid id="Grid" allowPaging="true" allowSorting="true" allowFiltering="true">
    <e-data-manager url="/Organizations/LoadData" updateUrl="/Organizations/UpdateData" adaptor="UrlAdaptor"></e-data-manager>
    <e-grid-columns>
        <e-grid-column field="Name" headerText="Name"></e-grid-column>
    </e-grid-columns>
</ejs-grid>


Here's the data that the URL returns...

[{"OrgID":1,"Name":"Agency, LLC","Nickname":"Agency","Description":"This is a demo agency","UserID":"8e82ece1-a036-4618-a116-13ac406629ac","User":null,"AddressID":2,"Address":null,"OfficePhone":"864-555-5555","OtherPhone":null,"OrganizationTypeID":2,"OrganizationType":null,"RouteOrgDonors":null,"RouteOrgAgencies":null,"AvailableOrgs":null,"DateAdded":"2019-07-08T08:56:41.1333333"},{"OrgID":2,"Name":"Donor LLC","Nickname":"Donor","Description":"Demo donor","UserID":"8e82ece1-a036-4618-a116-13ac406629ac","User":null,"AddressID":1,"Address":null,"OfficePhone":"864-555-5555","OtherPhone":null,"OrganizationTypeID":1,"OrganizationType":null,"RouteOrgDonors":null,"RouteOrgAgencies":null,"AvailableOrgs":null,"DateAdded":"2019-07-08T09:46:20.8533333"},{"OrgID":3,"Name":"Agency 2, LLC","Nickname":"Agency 2","Description":"Test","UserID":"8e82ece1-a036-4618-a116-13ac406629ac","User":null,"AddressID":2,"Address":null,"OfficePhone":null,"OtherPhone":null,"OrganizationTypeID":2,"OrganizationType":null,"RouteOrgDonors":null,"RouteOrgAgencies":null,"AvailableOrgs":null,"DateAdded":"2019-09-03T14:39:23.02"},{"OrgID":4,"Name":"Donor 2, LLC","Nickname":"Donor 2","Description":"Test","UserID":null,"User":null,"AddressID":1,"Address":null,"OfficePhone":null,"OtherPhone":null,"OrganizationTypeID":1,"OrganizationType":null,"RouteOrgDonors":null,"RouteOrgAgencies":null,"AvailableOrgs":null,"DateAdded":"2019-09-03T14:39:46.9033333"}]

Pavithra Subramaniyam [Syncfusion]
Replied On September 9, 2019 05:09 AM UTC

Hi Brad, 

For Essential JavaScript 2 UrlAdaptor, we need to return the server result as “result” and “count” pair. Please refer to the below documentation and demo link for more information. 


Demo                  : https://ej2.syncfusion.com/aspnetcore/Grid/UrlAdaptor#/material 

Please get back to us if you need any further assistance on this. 

Regards, 
Pavithra S. 


Brad Shannon
Replied On September 10, 2019 12:04 AM UTC

Thank you, I was able to get it working.  Now the Sort, Filter, etc aren't doing anything.  How do I get these functions working with a UrlAdaptor?

Brad Shannon
Replied On September 10, 2019 12:38 AM UTC

Disregard, I got sort working.  However, I'm getting an error when the code tries to get a count when I sort on a column whose field is set to the property of an object, like so...

<e-grid-column field="User.FullName" headerText="User"></e-grid-column>

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 11, 2019 11:08 AM UTC

Hi Brad, 
 
Thanks for your update. 
 
Query: I'm getting an error when the code tries to get a count when I sort on a column whose field is set to the property of an object, like so... <e-grid-column field="User.FullName" headerText="User"></e-grid-column> 
 
We have validated your query and we have checked the reported problem by creating a sample based on your requirement. Here, we have bind complex data with one of the columns of the grid. It(sorting) works fine. Please find the below code example and sample for your reference. 
 
[code snippets] 
<ejs-grid id="GridOverview" allowFiltering="true" allowPaging="true" allowSorting="true"> 
    <e-data-manager url="/Home/UrlDataSource" adaptor="UrlAdaptor"></e-data-manager> 
    <e-grid-pagesettings pageSize="4"></e-grid-pagesettings> 
    <e-grid-columns> 
        ... 
        <e-grid-column field="ShipCountry" headerText="Ship Country" width="150"></e-grid-column> 
        <e-grid-column field="Employee.Address" headerText="Address" type="string" width="90"></e-grid-column> 
    </e-grid-columns> 
</ejs-grid> 
public IActionResult UrlDatasource([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable DataSource = OrdersDetails.GetAllRecords(); 
            DataOperations operation = new DataOperations(); 
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                DataSource = operation.PerformSorting(DataSource, dm.Sorted); 
            } 
            ... 
           return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource); 
        } 
 
 
 
If you are still facing the same problem, could your please share the below details. It will be helpful to provide a better solution. 
 
  • Share the error details.
  • Share full grid code snippets.
  • Share datasource(controller side code) details.
 
Regards, 
Thavasianand S. 


Brad Shannon
Replied On September 11, 2019 11:57 AM UTC

This line is returning a null reference...

DataSource = operation.PerformSorting(DataSource, dm.Sorted);


Grid Code
<ejs-grid id="Grid" allowPaging="true" allowSorting="true" allowFiltering="true">
    <e-data-manager url="/Organizations/LoadData" updateUrl="/Organizations/UpdateData" adaptor="UrlAdaptor"></e-data-manager>
    <e-grid-columns>
        <e-grid-column field="Name" headerText="Name" allowSorting="true"></e-grid-column>
        <e-grid-column field="User.FullName" headerText="User" type="string"></e-grid-column>
        <e-grid-column field="Address.Address1" headerText="Address" type="string"></e-grid-column>
        <e-grid-column field="OfficePhone" headerText="Phone"></e-grid-column>
        <e-grid-column field="OrganizationType.Name" headerText="OrganizationType" type="string"></e-grid-column>
        <e-grid-column field="OrgID" template="#edittemplate"></e-grid-column>
    </e-grid-columns>
</ejs-grid>

<script id="edittemplate" type="text/x-template">
    <div>
        <a rel='nofollow' rel='nofollow' href="/Organizations/Edit/${OrgID}">Edit</a>&nbsp;|&nbsp;
        <a rel='nofollow' rel='nofollow' href="/Organizations/Details/${OrgID}">Details</a>&nbsp;|&nbsp;
        <a rel='nofollow' rel='nofollow' href="/Organizations/Delete/${OrgID}">Delete</a>&nbsp;
    </div>
</script>


Controller Code
        public IActionResult LoadData([FromBody]DataManagerRequest dm)
        {
            var sa = new JsonSerializerSettings();
            IEnumerable<Organization> DataSource = _context.Organization
                .Include(o => o.Address)
                .Include(o => o.OrganizationType)
                .Include(o => o.User)
                .ToList();
            DataOperations operation = new DataOperations();
            if (dm.Search != null && dm.Search.Count > 0)
            {
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search
            }
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            }
            int count = DataSource.Cast<Organization>().Count();
            if (dm.Skip != 0)
            {
                DataSource = operation.PerformSkip(DataSource, dm.Skip);         //Paging
            }
            if (dm.Take != 0)
            {
                DataSource = operation.PerformTake(DataSource, dm.Take);
            }

            return Json(new { result = DataSource, count = _context.Organization.Count() });
        }

Thavasianand Sankaranarayanan [Syncfusion]
Replied On September 12, 2019 07:35 AM UTC

Hi Brad, 
 
Thanks for your update. 
 
Query: This line is returning a null reference... DataSource = operation.PerformSorting(DataSource, dm.Sorted); 
 
We have prepared a sample based on your shared code snippets and checked the reported problem. We are unable to reproduce the reported problem at our end. We are getting the sort parameters at the server-end. Could you please share the below details.  
  • Share NuGet version details.
  • Share Essential Studio JS 2 package version details.
  • Share screenshot details of (DataManagerRequest dm) like below.
  • Replication procedure.
  • You can also modify the sample attached in the below and reproduce the issue.
 
 
 
Regards, 
Thavasianand S. 


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