Fix item detail for datagrid nested in another component - #1300
Open
radimvaculik wants to merge 1 commit into
Open
Fix item detail for datagrid nested in another component#1300radimvaculik wants to merge 1 commit into
radimvaculik wants to merge 1 commit into
Conversation
ItemDetailPlugin porovnával data-toggle-detail-grid (plain name) proti datagrid.name, který je full name komponenty, takže se u vnořeného gridu detail nikdy nerozbalil. Plugin nyní preferuje již renderovaný atribut data-toggle-detail-grid-fullname.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1300 +/- ##
=======================================
Coverage 49.12% 49.12%
=======================================
Files 63 63
Lines 2974 2974
=======================================
Hits 1461 1461
Misses 1513 1513 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 #1299
Problem
Datagridrendersdata-datagrid-name="{$control->getFullName()}"(src/templates/datagrid.latte:17), sodatagrid.namein JS is the component full name (eg.myComponent-grid). The detail row class uses the full name too (item-detail-{$control->getFullname()}-id-...).But
ItemDetailPlugincompareddatagrid.nameagainstdata-toggle-detail-grid, which only holds the plain name (grid). For a datagrid placed directly in a presenter both values are equal and everything works; as soon as the grid lives inside another component the comparison never matches and the item detail never toggles.Fix
src/Column/ItemDetail.phpalready rendersdata-toggle-detail-grid-fullname(added back in c1b5f57 "ItemDetail fix for multiple datagrids at same page") — the TypeScript plugin just never started using it during the jQuery → vanilla TS rewrite. The plugin now prefers the full name attribute and falls back to the plain one for hand-rendered buttons.No PHP change needed.
Notes
Other plugins (
checkboxes.ts,inline.ts) compare againstdata-check/payload._datagrid_name, both of which are already filled with the full name, so they are not affected.