We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Custom Datasource Field Name

Hello,

I have a spreadsheet with sheet bind from a datasource with the option 'FieldAsColumnHeader' set as true. The problem is that it always get the field name as it is in the datasource (ex.: I have a field called "ItemCode" and I would like it to show in the header as "Item Code"). Is there a way to customize the fields name that are shown in the header? It would help in the process of localization too.


Att,

3 Replies

SP Sangeetha Priya Murugan Syncfusion Team April 19, 2019 04:45 PM UTC

  
Hi Erik, 
 
Thank you for using Syncfusion products.  
 
We have checked your requirement and your requirement can be achieved using “columns” property in sheets object. Please refer the below code example to achieve your requirement.  
 
[JS]  
<script>   
    var dataSource = [   
            { "ItemName""Casual Shoes", Quantity: 10, Price: "20", Amount: "200", Discount: "1", Profit: "10" },   
            //...   
    ];   
    $(function () {   
        $("#Spreadsheet").ejSpreadsheet({   
            columnWidth: 100,   
            sheets: [{   
                dataSource: dataSource, fieldAsColumnHeader: true,   
                columns: [   
                    { field'A'textItem Name },   
                    { field: 'C', text: 'Header2' },   
                    { field: 'E', text: 'Header3' },   
                ]   
            }],   
        });   
    });   
</script>   
For your convenience, we have prepared the sample based on your requirement. Please find the link below. 
 
 
Regards, 
Sangeetha M 



UN Unknown Syncfusion Team April 22, 2019 01:03 PM UTC

Hi Sangeetha,

Thank you for the response. I did as in the example and it worked!


Att,


VK Vinoth Kumar Sundara Moorthy Syncfusion Team April 23, 2019 05:15 AM UTC

Hi Erik, 
 
We are happy to hear that your reported issue has been resolved. Please feel free to contact us if you need any further assistance on Syncfusion components. 
 
Regards, 
Vinoth Kumar S 


Loader.
Live Chat Icon For mobile
Up arrow icon