|
@Html.EJS().Grid("DefaultFunctionalities").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("120").Add();
col.Field("FirstName").HeaderText("Full Name").Width("150").ValueAccessor("valueAccess").Add();
}).Render()
</div>
<script>
function valueAccess(field, data, column) {
return data[field] + '-' + data['LastName'];
}
</script>
|
Hi Breno,
We have achieved your requirement by using ‘ValueAccessor’ property of Grid. The valueAccessor is used to access/manipulate the value of display data. You can achieve custom value formatting by using the valueAccessor. Please find the code example.
@Html.EJS().Grid("DefaultFunctionalities").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>{col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("120").Add();col.Field("FirstName").HeaderText("Full Name").Width("150").ValueAccessor("valueAccess").Add();}).Render()</div><script>function valueAccess(field, data, column) {return data[field] + '-' + data['LastName'];}</script>
Please find the documentation for your reference.
Regards,J Mohammed Farook