spartan icon indicating copy to clipboard operation
spartan copied to clipboard

Dynamic table columns

Open Olexandir opened this issue 1 year ago • 2 comments

Please provide the environment you discovered this bug in.

Idn is it bug or feature request

Which area/package is the issue in?

data-table

Description

I wanted to render my columns dynamically within data-table component

@for (company of _brnColumnManager.allColumns; track $index) { <brn-column-def [name]="company.name" class="w-32 sm:w-40"> <hlm-th truncate *brnHeaderDef>Company <hlm-td truncate *brnCellDef="let element"> {{ element.company.name | titlecase }} }

But I have an error

Please provide the exception or error you saw

common.service.ts:19 ERROR Error: Could not find column with id "company".
    at getTableUnknownColumnError (table.mjs:1386:10)
    at table.mjs:2434:15
    at Function.from (<anonymous>)
    at _CdkTable._getCellTemplates (table.mjs:2431:18)
    at _CdkTable._renderCellTemplateForItem (table.mjs:2397:35)
    at _CdkTable._renderRow (table.mjs:2393:10)
    at table.mjs:2313:50
    at Array.forEach (<anonymous>)
    at _CdkTable._forceRenderHeaderRows (table.mjs:2313:25)
    at _CdkTable._render (table.mjs:2138:12)

Other information

Dynamically, it can't realise column id's

I would be willing to submit a PR to fix this issue

  • [X] Yes
  • [ ] No

Olexandir avatar Jul 29 '24 07:07 Olexandir

I'd also like to be able to add columns with @for I think I have an idea of how to implement it, I'll try to open a PR within a couple days

guillermoecharri avatar Sep 04 '24 20:09 guillermoecharri

please any update on this @guillermoecharri @goetzrobin , did you find a solution @Olexandir

SOG-web avatar Mar 19 '25 20:03 SOG-web