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

Comparison table does not work in web embed #70

Open
psobolewski1992 opened this issue Aug 20, 2024 · 0 comments
Open

Comparison table does not work in web embed #70

psobolewski1992 opened this issue Aug 20, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@psobolewski1992
Copy link

psobolewski1992 commented Aug 20, 2024

In web embed, comparison table does not render due to the following line:

{fields[0].value.map((val: string, idx: number) => {
              const field = {
                type: 'Text',
                config: {
                  text: val,
                  displayMode: 'DISPLAY_ONLY'
                }
              };
              return (
                <th scope='col' key={`${tableId}-col-${idx}`} id={`${tableId}-col-${idx}`}>
                  {getPConnect().createComponent(field)}
                </th>
              );

This syntax works perfectly fine in normal portal but does not render in web embed, due to the following error:
TypeError: Failed to construct 'Text': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
Since we do not know what are necessary attributes of text field we changed field object to:

 const field = {
                type: 'TextInput',
                config: {
                  text: `${val}`,
                  value: `${val}`,
                  label: '',
                  displayMode: 'DISPLAY_ONLY'
                }
              };

After performing this change, table renders correctly.

@ricmars ricmars self-assigned this Oct 23, 2024
@ricmars ricmars added the bug Something isn't working label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants