var grid = new ej.grids.Grid({
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 120, textAlign: 'Right' },
{ field: 'CustomerName', headerText: 'Customer Name', width: 150, disableHtmlEncode:false,
valueAccessor: valueAccess },
. . . . .
]
});
grid.appendTo('#Grid');
function valueAccess(field, data, column) {
return '<span>CustomerName</span>'
}
|
Your example is actually showing the 'CustomerName' as string rather its actual value.
So this shared example is not working.
Hi Customer,
Thanks for your update.
We have analyzed your query, your want to show the actual value of the column while using valueAccessor property. We can achieved your requirement by modifying our provided sample using data and field in valueAccessor function.
Kindly refer the below code and sample for your references.
[index.js] function valueAccess(field, data, column) { var createdData = '<span>' + data[field] + data['OrderID'] + '</span>'; return createdData; } |
Sample link : https://stackblitz.com/edit/ptyea9-27hv6z?file=index.js
Documentation link : https://ej2.syncfusion.com/documentation/grid/columns/columns/#valueaccessor
Please get back to us, if you need any further assistance.
Regards,
Vinitha Balasubramanian