formatting in aggregate row does not work

Hi.
Double value formatting in aggregate row does not work
Thx!!

3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team May 30, 2018 04:01 PM UTC

Hi Alex, 

Thanks for using Syncfusion products. 

We have tried to reproduce the reported issue but its unsuccessful. We have prepared a sample based on your requirement that can be download from following link, 

In this sample, we have enabled the Aggregate row with formatting for Double value. Please refer to the following code example, 
[Grid] 
<ejs-grid id="Grid" dataSource="ViewBag.datasource" allowPaging="true"> 
          . .  .     
<e-grid-aggregates> 
        <e-grid-aggregate> 
            <e-aggregate-columns> 
                <e-aggregate-column field="Freight" type="Sum" format="C2" footerTemplate="Sum:${Sum}"></e-aggregate-column> 
            </e-aggregate-columns> 
        </e-grid-aggregate> 
         
    </e-grid-aggregates> 
    .  . . 
    <e-grid-columns> 
. .   . 
    </e-grid-columns> 
 
</ejs-grid> 
 
[Cs code] 
            public int? OrderID { get; set; } 
            . .  . 
            public Double? Freight { get; set; } 
                 . .   . 

If you still face the same issue, then could you please share the following details? 
1)      Share the Aggregate code example and Grid code example. 
2)      Share the Issue screenshot. 
3)      Share the replication procedure to reproduce the issue. 
4)      Please modified the given sample as issue reproducible. 
 
Regards, 
Venkatesh Ayothiraman. 



AL Alex June 1, 2018 09:57 AM UTC

Hi!
In my case, the first time the grid is initialized with an empty array, then for some event the grid gets data. I have modified your sample and attached it.
Thx!!!


Attachment: aggregateFormat_80c48b83.zip


VA Venkatesh Ayothi Raman Syncfusion Team June 4, 2018 12:34 PM UTC

Hi Alex, 

Thanks for the update. 

We have found the column type using Grid cell values when we didn’t define the column’s type. As for aggregate columns, we have applied the format based on column type. In this case, you have initially bound the empty data source and didn’t define the column’s type. This is the cause of this issue and we suggest you define the column’s type property to resolve this issue like as follows, 

... 
var ej2_grid = new ej.grids.Grid({ 
        dataSource:[],             
        allowGrouping: true, 
        groupSettings: { columns: ["ShipCountry"]}, 
        columns: [. .  . 
        { field: "ShipCountry", headerText: "Ship Country", type:'string', width: "140" }, 
        { field: "Freight", headerText: "Freight", type:'number', textAlign: "Right", width: "160", format: "C2", } 
        ], 
        aggregates: [ 
            { columns: [{ field: "Freight", format: "C2", groupCaptionTemplate: "${Sum}", type: "Sum" }] } 
        ]         
    }); 


We have also modified the sample which can be download from following link, 


Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon