Bug Fix events on inner elements overriden by the existence of a custom render function #92
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.
This addresses the following scenario:
I am adding existing (non-rendered to the DOM) TRs to DT with events
attached to their children.
I want a custom render function for providing filter and sort data, but
not display data. If there is a custom render function it overrides all
data including display data and overwrites the original cell content
(even if the data is unchanged) which results in the fact that events
of children inside the cell are lost.
This could be prevented if the render function can signal DT that it
doesn’t want to override the data and it wants to use the original
display data. Returning undefined is a good signal.
To address this issue, before overwriting the innerData of a cell using
the display data from the custom render function you can check whether
the data is null (undefined gets turned into null at this point).
And for all intents and purposes there is no point in overwriting the
cell content with null or undefined. Of course overwriting it with an
empty string ”” works correctly and would replace the display data (so
does null).
P.S. Changes are distributed under the terms of the MIT license, of course.