I have a grid with 3 frozen columns. The first time the grid is ok but when data source change it doesn't work. If I disable frozenColumns, all works perfectly.
<template>
<div id="app">
<ejs-grid
locale="fr"
:dataSource="items"
:allowSorting="true"
:allowResizing="true"
:allowPaging="true"
:allowFiltering="true"
:allowGrouping="false"
:filterSettings="filterOptions"
:searchSettings="searchOptions"
:pageSettings="pageSettings"
:selectionSettings="selectionOptions"
:dataBound="dataBound"
:frozenColumns="0"
@recordClick="recordClick($event)"
:rowSelected="rowSelected"
rowHeight="38"
height="100%"
ref="grid"
>
<e-columns>
<e-column type="checkbox" textAlign="Center" width="50"></e-column>
<e-column
width="80"
textAlign="Center"
:template="colTemplate"
:allowSorting="false"
></e-column>
<e-column
v-for="field in fields.filter((f) => f.key !== actionsProp)"
:key="field.key"
:field="field.key"
:headerText="field.label"
:allowSorting="field.sortable"
:disableHtmlEncode="false"
width="150"
></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import {
GridPlugin,
Resize,
Sort,
Page,
Filter,
Group,
Freeze,
} from "@syncfusion/ej2-vue-grids";
import ButtonActionsTableSF from "@/components/common/ButtonActionsTableSF.vue";
Vue.prototype.$eventHub = new Vue();
Vue.use(GridPlugin);
export default {
components: {
ButtonActionsTableSF,
},
props: {
items: Array,
fields: Array,
filterValue: String,
loading: Boolean,
actionsProp: {
type: String,
default: "#",
},
},
provide: {
grid: [Page, Resize, Sort, Filter, Group, Freeze],
},
created() {
this.$eventHub.$on("edit", (id) => {
this.$emit("edit", id);
});
this.$eventHub.$on("remove", (id) => {
this.$emit("remove", id);
});
},
data: () => {
return {
colTemplate: function () {
return { template: ButtonActionsTableSF };
},
pageSettings: {
pageSizes: [10, 25, 50, 100, 200],
pageCount: 4,
pageSize: 25,
},
filterOptions: {
type: "Excel",
},
filter: {
type: "CheckBox",
},
selectionSettings: {
persistSelection: true,
type: "Multiple",
checkboxOnly: true,
},
selectionOptions: { mode: "Row", checkboxMode: "ResetOnRowClick" },
};
},
methods: {
// Evènement onClic sur la ligne
recordClick: function (args) {
if (args.cellIndex > 1) {
this.$emit("rowClick", args.rowData);
}
},
rowSelected: function (args) {
this.$emit("selectionChange", this.$refs.grid.getSelectedRecords());
},
},
computed: {
searchOptions: function () {
return {
operator: "contains",
key: this.filterValue ? this.filterValue : "",
ignoreCase: true,
};
}
},
};
</script>
<style>
@import "../../../node_modules/@syncfusion/ej2-base/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-buttons/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-calendars/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-dropdowns/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-inputs/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-navigations/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-popups/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-splitbuttons/styles/bootstrap.css";
@import "../../../node_modules/@syncfusion/ej2-vue-grids/styles/bootstrap.css";