export default {
  methods: {
    handleHeaderDragEnd(newWidth, oldWidth, column, event) {
      this.columns = this.columns.map((obj) => {
        if (obj.columnName === column.property) {
          return { ...obj, width: newWidth };
        }
        return obj;
      });

      this.$nextTick(() => {
        if (this.$refs.toolBarRef && this.$refs.toolBarRef.saveConfig) {
          this.$refs.toolBarRef.saveConfig(this.columns);
        } else {
          console.error('toolBarRef is not ready or saveConfig is not a function');
        }
      });
    },
    customColsHandler(columns) {
      this.columns = columns;
      this.rndKey = Math.random();
    }
  }
}
