Hi Albert,
Since you’re using Polymer 2 in your project, would it be an option for you to upgrade to a newer grid (4 (stable) or 5 (beta)) instead of the hybrid version 3? Running bower install vaadin/vaadin-grid#^5.0.0 (and resolving with the newest versions) in the root of the example project makes the page load significantly faster on Firefox.
After installing the upgrade, I immediately see that our build breaks because it relies on components (such as vaadin-grid-cell-click-behavior) which are no longer there.
There’s always the option of copying the vaadin-grid-cell-click-behavior sources from grid 3 to your project and using that. G5 sure has a similar mixin but like vaadin-grid-cell-click-behavior, it’s an internal/private grid module so it should not be depended to via grid sources.
I’d rather not do something like that because it makes code maintenance complicated.
What is still unclear to me is whether my project example has indeed uncovered issues in vaadin-grid 3.0.2, and if so, whether this problem with Firefox has been understood (though perhaps manifested in a different way) and is solvable using the pre-5.0.0 version. (A different possibility is that my code could also be doing something intrinsically wrong … though at the moment I am not sure what that would be.)
While it is desirable eventually to move to 5.0.0, I need to be able to backport a fix, if possible, to a stable branch, which would mean avoiding an upgrade of a dependency when it requires significant code restructuring.
I’ve decided to look into migrating my code to the more modern grid implementation. I think I may be able to do without the cell click behavior by just attaching a normal listener. However, I am now seeing that the styling of the table needs to be done differently. I don’t see any documentation for what to do in 4+, but I would like to maintain the old styling if possible (it has now disappeared).
For instance, as in the demo I provided, something like this:
It looks like only the styling is now an obstacle. I have looked at the comments on the table element but I cannot get the above to work. I prefer to retain the style I have already devised. It would be really helpful if you could indicate to me what I need to do to migrate the css mixins that were once available (as above) so that they now work with 4.1.7.
CSS mixins are no longer used (as they are not on a standards track anymore, so we don’t want to depend on them). You need to use special style modules instead, that “inject” CSS inside the shadow DOM.
Thank you very much for the leg up here. I’ve just started familiarizing myself with the newer way of handling this and your example is very helpful. I see now how it is also applied inside the vaadin-grid components.
I hate to be such a nuisance, but I have one last question. In the example you gave, you styled the body-cell for the odd attribute. The vaadin-grid documentation, however, states that this is an attribute of row.
the striped even-odd rows is not the only problem I have now encountered moving from 3.0.2 to 4.1.7.
It seems that on page load the table provider gets called multiple (I count about 5) times. I have a provider which does lazy loading from a RESTful service (paged), and this is messing things up because these multiple calls all ask for the initial page number + page size.
Is there a way to avoid having the provider called multiple times like this (i.e., before one even scrolls)?
Ah, it’s being called every time a filter is set on the table (during load) – filterChanged – and there are 6 table column filters, so it is called 6 times.
I am setting the provider in connectedCallaback. Is there a way of delaying this until the entire table is built?