Grid valueAccessor

Hi. The documentation says that valueAccessor accept a string type, but helper need an object.
Thx



1 Reply

DR Dhivya Rajendran Syncfusion Team March 26, 2018 04:41 PM UTC

Hi Alex, 
Thanks for contacting Syncfusion support, 

We have validated your query and we will update our documentation. Here we have created a sample for your reference,  In this below sample we have customize the freight column value by using valueAccessor property of Grid and assigned the valueAccessor property in load event. Please refer the below code snippet and sample for more information. 

index.cshtml
 
<div> 
    <ejs-grid id="Grid" allowPaging="true" load="load "dataSource=ViewBag.DataSource height="315"> 
            <e-grid-column field="Freight" headerText="Freight" width="120"></e-grid-column> 
    </ejs-grid> 
</div> 
<script> 
    function load() { 
        this.columns[0].valueAccessor = currencyFormatter 
    } 
    function currencyFormatter(field, data, column) { 
        return data['Freight'] + ' € '; 
    } 
</script> 


Please get back to us if you need further assistance. 

Regards,
R.Dhivya 


Loader.
Up arrow icon