Hi Inzitari,
Thanks for contacting Syncfusion support.
We can’t apply different format in the same column at directly. This default behavior. But we can be achieved your requirement as a workaround by using ‘QueryCellInfo’ event of Grid. Please find the code example
@Html.EJS().Grid("FlatGrid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").Width("120").IsPrimaryKey(true).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").Add();
col.Field("Freight").HeaderText("Freight").Width("120"). TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
}).AllowPaging().QueryCellInfo("QueryCellInfo").Render()
</div>
<script>
function QueryCellInfo(args) {
if (args.column.field == 'Freight') {
var value = parseFloat(args.cell.innerText);
args.cell.innerText = '$' + (value < 1 ? value.toFixed(6) : value.toFixed(2)) // change decimal ;
}
}
</script>
|
Please find the documentation and screenshot for your reference.
Regards,
J Mohammed Farook