Open probert94 opened 5 years ago
You are right, this line is causing it: https://github.com/vaadin/vaadin-grid/blob/77defe3be558b3ba10ce21e7a6c87b38403a5790/src/vaadin-grid-column.html#L178-L179
This has been implemented in vaadin/vaadin-grid#1532 and previously submitted as vaadin/vaadin-grid#1416
We have this kind of "naming convention" because of the fact that we can't check el instanceof GridElement
in Polymer 3 version, as the order of upgrading custom elements is not guaranteed and apparently in some cases this code is called before vaadin-grid
has upgraded.
@web-padawan thank you for sharing the information.
In your opinion, would it be possible to allow a custom (non vaadin
) prefix?
Following regex would, for example, allow a single custom prefix, but the component has to end with grid
or grid-pro
:
^[a-z A-Z 0-9]+(-grid(-pro)?$)
👍 I don't see a reason why the column should only accept vaadin-
prefixed hosts.
Workaround: If you're extending the grid with a custom prefix, you could also extend the column class and override the protected _findHostGrid
in the extension:
<my-grid>
<my-column></my-column>
<my-column></my-column>
</my-grid>
@tomivirkki thank you for sharing the workaround.
As I am using Vaadin Flow, the workaround will probably be a bit more complex, so I will use the vaadin
-prefix for now.
But I'm glad you share my opinion about the custom prefix.
Description
I would like to extend the
vaadin-grid
with custom behaviour. I used the implementation of thevaadin-grid-pro
as a reference and created acustom-grid
without additional logic.Expected outcome
The
custom-grid
should be rendered as thevaadin-grid
.Actual outcome
The following error is thrown:
Notes
The reason for the error is, that in vaadin-grid-column#_findHostGrid, the
localName
of the GridElement is expected to match/^vaadin.*grid(-pro)?$/
. When I rename thecustom-grid
tovaadin-custom-grid
, it works as expected.I understand, that you have to search for the
GridElement
using some restricted name, but in my opinion the current logic is too restrictive, as it enforces avaadin
-prefix, which is usually used by official components only.