$onInit()

in modules/frontend/app/components/ui-grid/controller.js [80:153]


    $onInit() {
        this.SCROLLBAR_WIDTH = this.gridUtil.getScrollbarWidth();

        if (this.gridThin) {
            this.rowHeight = 36;
            this.headerRowHeight = 48;
        }

        this.grid = {
            appScopeProvider: this.$scope.$parent,
            data: this.items,
            columnDefs: this.columnDefs,
            categories: this.categories,
            rowHeight: this.rowHeight,
            multiSelect: !this.singleSelect,
            enableSelectAll: !this.singleSelect,
            headerRowHeight: this.headerRowHeight,
            columnVirtualizationThreshold: 30,
            enableColumnMenus: false,
            enableFullRowSelection: true,
            enableFiltering: true,
            enableRowHashing: false,
            fastWatch: true,
            showTreeExpandNoChildren: false,
            modifierKeysToMultiSelect: true,
            selectionRowHeaderWidth: 52,
            exporterCsvColumnSeparator: ';',
            onRegisterApi: (api) => {
                this.gridApi = api;

                api.core.on.rowsVisibleChanged(this.$scope, () => {
                    this.adjustHeight();

                    // Without property existence check non-set selectedRows or selectedRowsId
                    // binding might cause unwanted behavior,
                    // like unchecking rows during any items change,
                    // even if nothing really changed.
                    if (this._selected && this._selected.length && this.onSelectionChange) {
                        this.applyIncomingSelectionRows(this._selected);

                        // Change selected rows if filter was changed.
                        this.onRowsSelectionChange([]);
                    }
                });

                if (this.onSelectionChange) {
                    api.selection.on.rowSelectionChanged(this.$scope, (row, e) => {
                        this.onRowsSelectionChange([row], e);
                    });

                    api.selection.on.rowSelectionChangedBatch(this.$scope, (rows, e) => {
                        this.onRowsSelectionChange(rows, e);
                    });
                }

                api.core.on.filterChanged(this.$scope, (column) => {
                    this.onFilterChange(column);
                });

                this.$timeout(() => {
                    if (this.selectedRowsId) this.applyIncomingSelectionRowsId(this.selectedRowsId);
                });

                this.resizeObserver = new ResizeObserver(() => api.core.handleWindowResize());
                this.resizeObserver.observe(this.$element[0]);

                if (this.onApiRegistered)
                    this.onApiRegistered({$event: api});
            }
        };

        if (this.grid.categories)
            this.grid.headerTemplate = headerTemplate;
    }