Collapse grouped rows at initial render in Vue Grid component

16 Mar 20232 minutes to read

You can collapse all the grouped rows at initial rendering by using dataBound event with collapseAll method of the grid.

In the below demo, all the grouped rows are collapsed at initial rendering.

    <div id="app">
        <ejs-grid ref='grid' :dataSource='data' :allowGrouping='true' :groupSettings='groupOptions' :dataBound='dataBound' height='267px'>
                <e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
                <e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
                <e-column field='ShipCity' headerText='Ship City' width=150></e-column>
                <e-column field='ShipName' headerText='Ship Name' width=150></e-column>
import Vue from "vue";
import { GridPlugin, Group } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';


var initial = true;
export default {
  data() {
    return {
      data: data,
      groupOptions: { columns: ['ShipCity'] }
  methods: {
    dataBound: function() {
        if(initial === true) {
            initial = false;
  provide: {
    grid: [Group]
 @import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";