How to show odata nested element count? Naming problem

Hi great support;
I have odata source grid here;


My json result is;


[email protected]

this property name  is not ok for sfgrid column field name;


What shoul i type on "Field" ? or how can i change display name in json result?
Thanks .

11 Replies

JP Jeevakanth Palaniappan Syncfusion Team September 1, 2020 01:26 PM UTC

Hi Blazor, 

Greeting from Syncfusion support. 

We have validated your query and found that you have used the dot(.) and @ in the grid field. By default in the grid, if we use a dot(.) in the field name of the grid then we will consider it as a complex field. so for other cases, there should not be any dot(.) in the field name. Also by C# standard @ is not accepted in the property name(public string First@Name { get; set; }) of a Model Class. Please refer the below documentation link for complex fields. 


Please get back to us if you need further assistance. 

Regards, 
Jeevakanth SP. 



BL Blazor September 1, 2020 08:26 PM UTC

Hi Jeevakanth thanks,
I know these(your link) rules, already using it.

But i need to get count information from odata.

Odata "count" defaultly gives this(
[email protected]) name as a reasult. (You can check my query)
So i want to know how can i show this property on my grid?

If you know any way to manipulate odata count property name, i can also accept it.



JP Jeevakanth Palaniappan Syncfusion Team September 4, 2020 01:47 PM UTC

Hi Blazor, 

By default, the grid will accept only the Model properties. Here, Model class property names will be in C# standard and we are unable to add a property using ‘@’ special character in model class as we already mentioned. We suspect that you would like to get the count and show in the Grid component.  

If so, you can modify the OData service JSON data by setting the value of @odata.count in the proper naming conversion property directly in the OData service so that the value will be returned as an integer in the JSON result. 

Code example: 

Value:[ 
.  . .    
Count = 2, //@odata.count value 
… 


Also,  we have Column template feature of the grid to display the customized value of [email protected] property. Please find the below documentation link for Column template. 


Regards, 
Jeevakanth SP. 



BL Blazor September 4, 2020 02:47 PM UTC

Thanks Jeevakanth ,

I think, i have to modify odata result like you said.
I don't know how, but this is not 
syncfusion responsibility.

Good day.


JP Jeevakanth Palaniappan Syncfusion Team September 7, 2020 06:41 AM UTC

Hi Blazor, 

Thanks for the update. Please get back to us if you need any further assistance. 

Regards, 
Jeevakanth SP. 



BL Blazor September 15, 2020 10:32 PM UTC

Hi again,
 Unfortunately i couldn't find a way to manupulate "[email protected]" property name in asp.net core api
I would be glad if some one shows me how.

I can't show "expanded object count" on my grid.


JP Jeevakanth Palaniappan Syncfusion Team September 18, 2020 01:19 PM UTC

Hi Blazor, 

To proceed further, kindly share us the below details so that we will check the possible ways to achieve your requirement from our end. 

  1. Please share the model class and the way you are binding the data.
  2. Share the complete grid code.
  3. If possible kindly share us the issue reproducing sample so that it will be helpful for us to validate further.

Regards, 
Jeevakanth SP. 



BL Blazor September 18, 2020 08:34 PM UTC

Here is my grid;


My odata query;
odata/dersacilans?$expand=derskayits($count=true;$top=0),akademisyen

I am trying to get "derskayits" count, under "dersacilans"

Here is Fiddler result;


So, "[email protected]" comes defaultly from odata,
I couldn't dispaly on my grid.




JP Jeevakanth Palaniappan Syncfusion Team September 24, 2020 03:56 PM UTC

Hi Blazor, 

On analyzing your grid code, we suspect that you can render the [email protected] property value by using the column template feature only if you get the value of [email protected] property in the template context. Please try it by using the below reference documentation of the column template. 


Also, we found suggestions from stack overflow. Please refer the below link it may help you to achieve your requirement. 


Regards, 
Jeevakanth SP. 



BL Blazor September 29, 2020 09:08 PM UTC

Hi again,
I tryed but i think its not possible to show odataV4 nested entity count on grid;

I opened my odata service if you wanna try by your self;

http://20.188.58.226:53416/odata/dersAcilans?$expand=derskayits($count=true;$top=0),akademisyen




JP Jeevakanth Palaniappan Syncfusion Team October 5, 2020 12:39 PM UTC

Hi Blazor, 

Thanks for sharing the odata service. We tried to show the count property in the grid but we are unable to achieve this scenario due to C# standards. 

Please get back to us if you have any further queries. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon