DataGrid + Localization

Hi, i've the following razor page:

@page


@modelIndexModel
@{
ViewData["Title"]="Contratti in essere";
}


<ejs-breadcrumb id="default">
</ejs-breadcrumb>




<ejs-grid id="Grid" allowPaging="true" locale="it" rowDataBound="rowDataBound" dataBound="dataBound">
<e-grid-pagesettings pageSize="5" pageSizes="@(new string[] { "5", "10" , "15", "20", "50", "100" })"></e-grid-pagesettings>
<e-data-manager url="https://localhost:44376/Contracts/Contract" adaptor="UrlAdaptor"></e-data-manager>
<e-grid-aggregates>
<e-grid-aggregate>
<e-aggregate-columns>
<e-aggregate-column field="ContractAmount" type="Sum" footerTemplate="Totale Generale:${Sum}" format="C2"></e-aggregate-column>
</e-aggregate-columns>
</e-grid-aggregate>
</e-grid-aggregates>
<e-grid-columns>
<e-grid-column field="ContractId" headerText="Contract ID" textAlign="Center" width="120" visible="false"></e-grid-column>
<e-grid-column field="ContractClientName" headerText="Cliente" headerTextAlign="Center" textAlign="Left" width="120"></e-grid-column>
<e-grid-column field="ContractName" headerText="Contratto" headerTextAlign="Center" textAlign="Left" width="120"></e-grid-column>
<e-grid-column field="ContractStartDate" headerText="Data Inizio" textAlign="Center" format="dd/MM/yyyy" width="120"></e-grid-column>
<e-grid-column field="ContractEndDate" headerText="Data Fine" textAlign="Center" format="dd/MM/yyyy" width="120"></e-grid-column>
<e-grid-column field="ContractAmount" headerText="Importo" headerTextAlign="Center" textAlign="Right" format="C2" width="120"></e-grid-column>
</e-grid-columns>
</ejs-grid>
@sectionStyles{
<style>
.e-grid .e-altrow {
background-color: #fafafa;
}
</style>
}
@sectionScripts{
<script src="~/js/SetLocale.js"></script>




<script type="text/javascript">
    function customAggregateFn(data, aggColumn) {


    };


    function rowDataBound(args){


    };


    function dataBound(args){


};
</script>
}

The grid is populated from remote API.The problem is that the API was called two times because when the localization is active and the followings statements produces an exception:


List str =newList();
if(dm.Aggregates!=null)
{
for(var i =0; i < dm.Aggregates.Count; i++)
                    str.Add(dm.Aggregates[i].Field);
}
IEnumerable aggregate = operation.PerformSelect(DataSource, str);


Thanks

Stefano




1 Reply

RR Rajapandi Ravi Syncfusion Team November 15, 2021 12:51 PM UTC

Hi Stefano, 

Greetings from Syncfusion support 

Before we start providing solution on your query, we need some information for our clarification. Please share the below details that will be helpful for us to provide better solution. 

1)             In your query you have mentioned that “the API was called two times because when the localization is active”. So please share the screenshot of network tab response. 

2)             Also, in your query you have mentioned that “when using the aggregates statement, it produces the exception”. So please share the screenshot of exception details. 

Regards, 
Rajapandi R 



Loader.
Up arrow icon