Support AOC column formatters in yui-polyfill#16
Open
SvenBrunk wants to merge 1 commit intoOXID-eSales:b-8.0.xfrom
Open
Support AOC column formatters in yui-polyfill#16SvenBrunk wants to merge 1 commit intoOXID-eSales:b-8.0.xfrom
SvenBrunk wants to merge 1 commit intoOXID-eSales:b-8.0.xfrom
Conversation
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.
What changed
This updates the AOC/DataTable polyfill row renderer so column definitions can use a
formatter(elCell, oRecord, oColumn, oData)callback, matching the YUI 2 DataTable column API shape that the admin templates already use.When a formatter is present on the matching column definition, the polyfill now calls it with:
getData()and_oDataWhen no formatter is configured, rendering falls back to the previous text/truncation behavior.
Why
The replacement AOC widget accepts the same column definition shape as the old YUI 2 DataTable integration, and several core popup templates already pass
formatter: YAHOO.oxid.aoc.custFormatterin their column definitions. The polyfill also declarescustFormatter(elCell, oRecord, oColumn, oData), which strongly suggests formatter support was intended.However, the current polyfill row renderer ignores the column's
formatterproperty and always writes the raw value into the cell. This means admin popups and modules cannot customize cell rendering through the documented column configuration and have to post-process the generated DOM afterdataReturnEventinstead.This came up while building an assignment popup for a shipping-zone module. The popup needs to render a stored include/exclude value as a localized label. Because the formatter callback is ignored today, the module has to carry a hidden label element and rewrite matching cells after every data reload. Calling the column formatter in the polyfill removes that workaround and restores the expected AOC/DataTable extension point.
Compatibility
This is intended to be backward compatible:
oRecord.getData()returns the row object, which supports existing core code such asarticle_extend.html.twig.oRecord.getData(field)also returns a single field value for formatter implementations that use keyed access.Verification
node --check out/admin_twig/src/js/widgets/yui-polyfill.js.Manual verification path:
elCell.innerText = 'hello';.hello.