Add target attribute to Magento_Ui grid #9964
Merged
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.
When creating a Magento_Ui grid actionColumn, currently, it is not possible for links to have a target attribute. They can only open in the current browser tab ie. their target is always _self. This change expands that, allowing a target attribute to be added when using the prepareDataSource function of a custom Column module.
Description
added method getTarget to actions.js - it returns "_self" by default or the attribute set when using prepareDataSource.
added code to set link's target attribute to getTarget() in the actions.html template
Code example - when populating the column in a Magento_Ui grid, using a custom class to expand Magento\Ui\Component\Listing\Columns\Column, you can set the target attribute for the links created in your prepareDataSource function, as below.
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist