Repository navigation
fix: patch renderer function instead of the template - #2481
Merged
Merged
Conversation
tomivirkki
marked this pull request as draft
January 7, 2022 11:42
tomivirkki
force-pushed
the
fix-lit-renderer-editor
branch
from
January 7, 2022 12:38
0d1ba4a to
b6700ab
Compare
tomivirkki
force-pushed
the
fix-lit-renderer-editor
branch
from
January 7, 2022 13:30
b6700ab to
27fc393
Compare
tomivirkki
commented
Jan 7, 2022
| "}" + | ||
|
|
||
| // If editing, render the editor, otherwise use the original renderer | ||
| "if (root.__editing) { root.innerHTML = `" + editorTemplate + "` }" + |
|
|
||
| // If editing, render the editor, otherwise use the original renderer | ||
| "if (root.__editing) { root.innerHTML = `" + editorTemplate + "` }" + | ||
| "else if (!originalRender) { root.textContent = model.item." + columnInternalId + " }" + |
Member
Author
There was a problem hiding this comment.
A fallback mechanism for columns without a renderer function. Previously here
tomivirkki
marked this pull request as ready for review
January 7, 2022 14:53
web-padawan
approved these changes
Jan 10, 2022
web-padawan
left a comment
Member
There was a problem hiding this comment.
LGTM for the changes in JS code (renderer looks about right).
sosa-vaadin
approved these changes
Jan 10, 2022
yuriy-fix
approved these changes
Jan 10, 2022
tomivirkki
enabled auto-merge (squash)
January 10, 2022 13:53
vaadin-bot
pushed a commit
that referenced
this pull request
Jan 10, 2022
tomivirkki
pushed a commit
that referenced
this pull request
Jan 10, 2022
Collaborator
|
This ticket/PR has been released with platform 23.0.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FIxes #2465
The current implementation of
EditorRenderermodifies the<template>element of a grid column so that its initial content gets wrapped inside adom-ifand anotherdom-ifwith the editor component renderer is added inside the same template.EditorRenderer.setupEditorTemplate(...)->If a column uses
LitRenderer, there's no<template>element involved, so this doesn't work.This PR changes
EditorRendererso that instead of modifying the<template>element (which may not be there), it patches therendererfunction of the column to conditionally either render the editor component or use the original function. Other than patching therendererfunction instead of the<template>element, the concept stays mostly the same.The
rendererapproach also works withComponentRendererand the deprecatedTemplateRenderer, because since Vaadin 21, they also use therendererfunction under the hood (via template-renderer adapter).