I'm working with Magento 2 and I need to configure an admin UI grid so that some rows cannot be selected via the checkbox column (i.e., they're unselectable in mass actions).
Is there a recommended way to make individual rows unselectable based on custom conditions or data in the row itself?
For example, I might want to flag some rows as non-actionable or protected, and prevent the user from selecting them via the mass action checkbox.
I'm using a custom UI grid defined via listing XML, with a block like this:
<selectionsColumn name="ids" sortOrder="10">
<settings>
<indexField>id</indexField>
<dataType>select</dataType>
</settings>
</selectionsColumn>
The grid uses a custom DataProvider that returns an array of items like this:
[
'totalRecords' => $totalRecords,
'items' => $pagedItems
];
Any guidance or best practices for achieving this in Magento 2 would be greatly appreciated!
1 Answer 1
maybe you can filter out that data after mass action so it will skip those rows, in any case you are hardcoding something. I would probably think about if I really need to have this or is there any other way to follow.
-
Preferably each row would have a button that you can use to lock and unlock that specific row. You also still need to see the data.Ruben Eekhof– Ruben Eekhof2025年05月14日 14:34:18 +00:00Commented May 14 at 14:34
Explore related questions
See similar questions with these tags.