mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	feat(views/table): render note icon
This commit is contained in:
		
							parent
							
								
									8e51469de5
								
							
						
					
					
						commit
						4a26f30d65
					
				@ -32,6 +32,18 @@ export async function buildData(parentNote: FNote, info: PromotedAttributeInform
 | 
			
		||||
 | 
			
		||||
export function buildColumnDefinitions(info: PromotedAttributeInformation[]) {
 | 
			
		||||
    const columnDefs: ColumnDefinition[] = [
 | 
			
		||||
        {
 | 
			
		||||
            field: "iconClass",
 | 
			
		||||
            title: "Icon",
 | 
			
		||||
            width: 40,
 | 
			
		||||
            headerSort: false,
 | 
			
		||||
            hozAlign: "center",
 | 
			
		||||
            formatter(cell) {
 | 
			
		||||
                console.log(cell);
 | 
			
		||||
                const iconClass = cell.getValue();
 | 
			
		||||
                return `<span class="bx ${iconClass}"></span>`;
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            field: "noteId",
 | 
			
		||||
            title: "Note ID",
 | 
			
		||||
@ -92,6 +104,7 @@ export async function buildRowDefinitions(parentNote: FNote, notes: FNote[], inf
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        definitions.push({
 | 
			
		||||
            iconClass: note.getIcon(),
 | 
			
		||||
            noteId: note.noteId,
 | 
			
		||||
            title: note.title,
 | 
			
		||||
            labels,
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@ import branches from "../../../services/branches.js";
 | 
			
		||||
import type { CommandListenerData, EventData } from "../../../components/app_context.js";
 | 
			
		||||
import type { Attribute } from "../../../services/attribute_parser.js";
 | 
			
		||||
import note_create from "../../../services/note_create.js";
 | 
			
		||||
import {Tabulator, SortModule} from 'tabulator-tables';
 | 
			
		||||
import {Tabulator, SortModule, FormatModule} from 'tabulator-tables';
 | 
			
		||||
import "tabulator-tables/dist/css/tabulator_bootstrap5.min.css";
 | 
			
		||||
 | 
			
		||||
const TPL = /*html*/`
 | 
			
		||||
@ -81,7 +81,11 @@ export default class TableView extends ViewMode<StateInfo> {
 | 
			
		||||
        const viewStorage = await this.viewStorage.restore();
 | 
			
		||||
        const initialState = viewStorage?.gridState;
 | 
			
		||||
 | 
			
		||||
        Tabulator.registerModule(SortModule);
 | 
			
		||||
        const modules = [SortModule, FormatModule];
 | 
			
		||||
        for (const module of modules) {
 | 
			
		||||
            Tabulator.registerModule(module);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.api = new Tabulator(el, {});
 | 
			
		||||
        this.loadData();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user