Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
145186 | Jun 11,2019 06:23 PM UTC | Jun 20,2019 07:29 AM UTC | Vue | 8 |
![]() |
Tags: Data Grid |
btnClick: function(event) {
var grid = this.$refs.grid.ej2Instances;
grid.dataSource = customerData; // Changed the Grid datasource
grid.columns = [// changed the Grid columns
{
field: "CustomerID",
headerText: "Customer ID",
width: 120
},
{
field: "CompanyName",
headerText: "Company Name",
width: 120
},
{
field: "ContactName",
headerText: "Contact Name",
width: 120
}
];
} |
<template>
<div id="app">
<ejs-grid :dataSource="data" height="315">
<e-columns>
. . .
<e-column field="Freight" headerText="Freight" textAlign="Right" :valueAccessor="currencyFormatter" width="80"></e-column>
<e-column field="ShipCity" headerText="Ship City" width="130" :valueAccessor="valueAccess"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
export default {
. . .
methods: {
currencyFormatter: function(field, data, column) {
return "€" + data["Freight"];
},
valueAccess: function(field, data, column) {
return data[field] + "-" + data["ShipRegion"];
}
}
};
</script> |
btnClick: function(event) {
var grid = this.$refs.grid.ej2Instances;
grid.columns = [
{
field: "CompanyName",
headerText: "Company Name",
width: 160,
valueAccessor:function(field, data, column) {
return "Accessed " + data["CompanyName"];
}
},
. . .
];
}
}
}; |
var grid = this.$refs.grid.ej2Instances;
console.log(grid.getPrimaryKeyFieldNames()); |
{
field: "Quantity",
headerText: "Quantity",
format: 'N2',
type: 'number',
width: 120
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.