Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration problems : Angular: KolTable #7333

Open
M-A-Bendig opened this issue Jan 29, 2025 · 0 comments
Open

Integration problems : Angular: KolTable #7333

M-A-Bendig opened this issue Jan 29, 2025 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@M-A-Bendig
Copy link

Hello,

we are currently working on a project utilising Angular.
In said project we are now using KoliBri for accessibility.
We encountered a problem.

Said problem occurred when we tried to use the KoliBri Table element ("KolTableStateful" ) containing nested HTML elements.
This should be possible according to the documentation ("https://public-ui.github.io/docs/components/table").
The nested elements were KoliBri buttons ("kol-button").

We used this variant for the inclusion of the nested HTML elements:

{
    render: (_el: {innerHTML: string}, data: KolTableRenderData, index: string, element) => {
        _el.innerHTML = `<kol-button _label="TEST" _variant="primary"></kol-button>`;
    },
}

In Angular there is a feature called "data binding" ("https://v17.angular.io/guide/binding-syntax").
Said feature is utilised for sharing data between HTML elements and the TypeScript code.

Using the kol-button component with data binding would look like the following:

<kol-button _label="TEST" _variant="primary" [_on]="callback"></kol-button>

This [_on]="callback" is where the data binding is used.

The TypeScript code for this example would be:

callbackOnInput = {
  onClick: (_event: Event, value: string) => {
    console.log(value);
  }
};

Considering this, our example for the table would be:

{
    render: (_el: {innerHTML: string}, data: KolTableRenderData, index: string, element) => {
        _el.innerHTML = `<kol-button _label="TEST" _variant="primary" [_on]="callback"></kol-button>`;
    },
}

...

callback = {
  onClick: (_event: Event, value: string) => {
    console.log(value);
  }
};

What now occurs is that Angular's data binding runs first and only then the content of the KoliBri table is rendered and thus the data binding is not applied to the elements inside the table.

Further the other features that Angular provides like
ViewChild ("https://angular.dev/api/core/ViewChild")
or
ViewChildren ("https://angular.dev/api/core/ViewChildren")
are not suited to solve this problem for similar reasons
as in the delayed rendering.

Working minimal example:
angular-kolibri.zip

@deleonio deleonio added the help wanted Extra attention is needed label Jan 30, 2025
@deleonio deleonio moved this to 🗂️ Backlog in KoliBri Board Jan 30, 2025
@deleonio deleonio removed the status in KoliBri Board Jan 30, 2025
@deleonio deleonio moved this to 🗂️ Backlog in KoliBri Board Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Status: 🗂️ Backlog
Development

No branches or pull requests

2 participants