0

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!

asked May 14 at 10:06

1 Answer 1

0

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.

answered May 14 at 14:29
1
  • 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. Commented May 14 at 14:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.