code: def groupByHeaderIndex(self):
          
          index = self.headerMenuColumn()
          columnTitle = self.columnOf(index)
          tableType = self.tableType()
          
          if not tableType:
              return
          
          column = tableType.schema().column(columnTitle)
          if not column:
              return
          
          self.setGroupBy(column.name())
          self.setGroupingActive(True)
docs: Assigns the grouping to the current header index.