[code]
// details generator
grid.rowDetailsGenerator = function (rowIndex) {
var details = document.createElement(‘div’);
grid.getItem(rowIndex, function (error, item) {
if (!error) {
var templateWrapper = document.getElementById(‘templateWrapper’);
var template = templateWrapper.querySelector(‘template’);
details.innerHTML = templateWrapper.querySelector(‘.licenseDetails’).outerHTML;
}
});
return details;
};
[/code]The problem is that the grid is not rendered. I can see it inside the HTML but it is not visible, somehow even if I set the height hardcoded I can’t see anything. Why?
What it looks very strange is how the internal DOM of the Details is rendered.
Somehow the entire Shadow DOM is not processed as it is supposed to be, even by re-creating your sample locally.
I don’t think there’s another way to create sub-grid. Not really sure what goes wrong in the initialization of the sub-grid, but something we should take a look at.
Hi Jouni, thank you for your reply.
It happens with any component, like any component/element inside the details somehow is not properly rendered, only plain HTML works. I am not sure if it’s a problem with the iframe of the table or what.
Appreciate the effort, hopefully the team will have time to look into this, because vaangrid is quite a good product.
I’m guessing that the templating gets in your way here, not hooking up to the right listener.
When creating details rows, I personally like to create a custom element for the row itself as I think that it makes things clearer. I can listen to/handle events interal to the details row element right in the element, or then fire events if I want to propagate the event further up.
Exactly, if you look at the DOM generated in the Shadow DOM, the vaadin grid is using an iframe. Probably the content provided inside the details element, is later rendered inside the same iframe, so it does not have access to the shadow DOM used by Polymer. That’s my feeling but I am waiting for an alternative solution. I will try your idea of having a separate template element for the details.