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

Add Dom Observers for Templates #890

Closed
hotforfeature opened this issue Jun 2, 2017 · 12 comments
Closed

Add Dom Observers for Templates #890

hotforfeature opened this issue Jun 2, 2017 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@hotforfeature
Copy link

Discussed with @Saulis. The grid won't work with Angular 2 and other libraries where elements are created and attached programatically.

Specifically, the column templates in Angular 2 are first created, then attached to <vaadin-grid-column> before child elements are attached to the <template>.

Adding some observers for when templates or their content changes will resolve any issues with programmatically creating and attaching a grid and its children. Alternatively, we could expose an API to inform the grid that its templates or columns have changed so that it knows to re-stamp them.

Relates to hotforfeature/origami#18 for Angular 4/Polymer 2 support.

@Analect
Copy link

Analect commented Jun 8, 2017

@Saulis ... we're keen to prototype vaadin-grid (v3 supporting polymer 2) in an angular4 context. Is this suggested fix alot of work to get in? Thanks.

@Saulis
Copy link
Contributor

Saulis commented Jun 8, 2017

@hotforfeature @Analect I've made a POC branch here column-template-observer which should work at least on a concept level. Could you guys try it out if you get any results when running on Angular?

@hotforfeature
Copy link
Author

I'll test out that branch and see how it works in Angular 4.

@hotforfeature
Copy link
Author

I tested and so far it looks like it's working! There's one change that needs to be made though:

https://github.com/vaadin/vaadin-grid/blob/master/vaadin-grid-column.html#L97

_prepareTemplatizer() can get called multiple times, and the template already has a templatizer. We should change this to

if (template && !template.templatizer) {

to ensure the templatizer doesn't get replaced.

@Analect
Copy link

Analect commented Jun 13, 2017

@Saulis ... posting @hotforfeature preliminary demo here (hope that's OK) based on those changes you had implemented on the column-template-observer branch.

Seems I forgot to add. Sorry. https://github.com/hotforfeature/origami/tree/vaadin/demo

@Analect
Copy link

Analect commented Jun 20, 2017

@Saulis ... do you think you might be able to roll in your changes in the column-template-observer branch with the small fix above? As per @hotforfeature comment here, that appears all that's needed to get vaadin-grid compatible with origami. Thanks.

@Saulis
Copy link
Contributor

Saulis commented Jun 21, 2017

@hotforfeature @Analect I've added the !template.templatizer check along with some tests to the column-template-observer branch (force pushed, so remember to run bower cache clean) – could you guys verify this version works better for you and I'll push a pull request for it. Thanks!

@hotforfeature
Copy link
Author

@Saulis works perfectly!

@Analect
Copy link

Analect commented Jun 27, 2017

@Saulis ... do you think your fix on column-template-observer could get included in your next release? Thanks.

@Saulis Saulis added enhancement New feature or request in progress labels Jun 29, 2017
@Saulis Saulis self-assigned this Jun 29, 2017
@Saulis
Copy link
Contributor

Saulis commented Jun 29, 2017

@Analect need to do some additional fixes to make it releasable, but I'll try to get a PR up asap.

@manolo
Copy link
Member

manolo commented Jul 3, 2017

Master build is not green, so moving this to the backlog until we spend some time to fix master.

@manolo manolo added ⭐️ and removed in progress labels Jul 3, 2017
@Analect
Copy link

Analect commented Jul 6, 2017

@manolo @Saulis ... is #918 any close to being merged? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants