getBookmarksGridColumns()

in client/client/app/components/ngbBookmarksPanel/ngbBookmarksTable/ngbBookmarksTable.service.js [77:180]


    getBookmarksGridColumns() {
        const headerCells = require('./ngbBookmarksTable_header.tpl.html');
        const columnsList = this.bookmarksTableColumns;
        const result = [];

        for (let i = 0; i < columnsList.length; i++) {
            let columnSettings = null;
            const column = columnsList[i];
            switch (column) {
                case 'chromosome': {
                    columnSettings = {
                        enableHiding: false,
                        enableFiltering: true,
                        enableSorting: true,
                        field: 'chromosome.name',
                        cellTooltip: true,
                        headerCellTemplate: headerCells,
                        minWidth: 40,
                        name: this.getBookmarksColumnTitle(column),
                        filterApplied: () => this.bookmarksFieldIsFiltered(column),
                        menuItems: [
                            {
                                title: 'Clear column filter',
                                action: () => this.clearBookmarksFieldFilter(column),
                                shown: () => this.bookmarksFieldIsFiltered(column)
                            }
                        ],
                        width: '*'
                    };
                    break;
                }
                case 'reference': {
                    columnSettings = {
                        enableHiding: false,
                        enableFiltering: true,
                        enableSorting: true,
                        field: 'reference.name',
                        cellTooltip: true,
                        headerCellTemplate: headerCells,
                        minWidth: 40,
                        name: this.getBookmarksColumnTitle(column),
                        filterApplied: () => this.bookmarksFieldIsFiltered(column),
                        menuItems: [
                            {
                                title: 'Clear column filter',
                                action: () => this.clearBookmarksFieldFilter(column),
                                shown: () => this.bookmarksFieldIsFiltered(column)
                            }
                        ],
                        width: '*'
                    };
                    break;
                }
                case 'info': {
                    columnSettings = {
                        cellTemplate: `
                                    <md-button
                                            class="md-accent md-flat bookmark-delete-button"
                                            type="button"
                                            aria-label="Clear history"
                                            ng-click="grid.appScope.$ctrl.onRemove(row, $event)"
                                    >
                                        <ng-md-icon icon="delete"></ng-md-icon>
                                    </md-button>`,
                        field: 'info',
                        headerCellTemplate: headerCells,
                        enableSorting: false,
                        enableFiltering: false,
                        enableColumnMenu: false,
                        minWidth: 20,
                        maxWidth: 40,
                        name: '',
                        width: '*'
                    };
                    break;
                }
                default: {
                    columnSettings = {
                        enableHiding: false,
                        enableFiltering: true,
                        enableSorting: true,
                        field: column,
                        cellTooltip: true,
                        headerCellTemplate: headerCells,
                        minWidth: 40,
                        name: this.getBookmarksColumnTitle(column),
                        filterApplied: () => this.bookmarksFieldIsFiltered(column),
                        menuItems: [
                            {
                                title: 'Clear column filter',
                                action: () => this.clearBookmarksFieldFilter(column),
                                shown: () => this.bookmarksFieldIsFiltered(column)
                            }
                        ],
                        width: '*'
                    };
                    break;
                }
            }
            result.push(columnSettings);
        }

        return result;
    }