I have a grid defined with a width of 100% and width or maxWidth directives on the e-column entries to enable horizontal scrolling. When I drag the window wider or narrower it all works as expected. The problem is that when I refresh the browser page, the widths aren't applied. Once I drag the window wider or narrower again, it corrects and displays the columns properly. Is there a way to force the grid to size the columns correctly after the refresh? Here's my code for the grid. I use a custom DataManager but that shouldn't impact anything here.
<template>
<div>
<ejs-grid id="MemberGrid" ref="grid" width="100%" :dataSource="dataSource" :allowPaging="true" :allowSorting="true" :allowSearch="true" :pageSettings="pageSettings" :searchSettings="searchSettings" :toolbar="toolbar"
:dataBound="dataBound" :rowSelected="onRowSelected">
<e-columns>
<e-column field="lastName" headerText="LAST NAME" :customAttributes="{ class: 'priority-column' }" minWidth="150"></e-column>
<e-column field="firstName" headerText="FIRST NAME" :customAttributes="{ class: 'priority-column' }" minWidth="150"></e-column>
<e-column field="memberNo" headerText="VIP MEMBER ID" minWidth="150"></e-column>
<e-column field="region" headerText="REGION" minWidth="150"></e-column>
<e-column field="paid" headerText="PAID" width="80"></e-column>
<e-column field="membershipTier" headerText="MEMBERSHIP TIER" minWidth="190"></e-column>
<e-column field="status" headerText="STATUS" width="110"></e-column>
<e-column field="email" headerText="EMAIL" :template="emailTemplate" minWidth="200"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from 'vue';
import { Page, Sort, Toolbar, Resize } from '@syncfusion/ej2-vue-grids';
import DataManager from '@/util/dataManager';
export default {
name: 'Members',
provide: {
grid: [Page, Sort, Toolbar, Resize]
},
data: () => {
return {
toolbar: ['Search'],
pageSettings: { pageSize: 10, pageSizes: true },
searchSettings: { fields: ['lastName', 'firstName', 'memberNo', 'membershipTier', 'email'] },
emailTemplate: function() {
return {
template: Vue.component('emailTemplate', {
template: `<a class="text-secondary font-bold" :rel='nofollow' href="'mailto:' + data.email">{{ data.email }}</a>`
})
}
},
}
},
computed: {
dataSource() {
return DataManager.create('members/indexdatatable', this);
}
},
methods: {
dataBound: function() {
this.$refs.grid.autoFitColumns(['paid', 'status', 'memberNo']);
},
}
};
</script>