selection – “Shopping Cart behaviour” for selecting rows in a table?

I’m currently struggling with the design of a table that would allow the user to select rows/items from a filtered/unfiltered table (probably with a standard checkbox column) and then still keep this selection when the search or filters of the table gets changed.

On top of that “shopping cart” management (add or remove items, or clear the selection), there will be some specific batch actions that can be applied to the selected items; like adding all of them to a group, having those entries deleted (not from the selection, but from the system) and so on.

I considered using a tab that shows a table with the selected rows:

enter image description here

But that is a no-go, since we already use tabs like this to, for example, separate entries by a specific type (something like “current tasks” from “done tasks”).

Right now I’m fiddling with a bar on top of the title row that expands and replaces the “full list” table:

enter image description here

enter image description here

I’m not really happy with this, since the position of the bar will probably confuse the users on what they are seeing on the table and how it relates to that bar.

Using the bar on the bottom is also off the table (pun intended), since we use infinite scroll on tables (that can easily have hundreds of entries) and the navigation buttons (like “next-step”) already sit on a fixed bar on the bottom of the page.

I think that’s it. If anyone can help with examples or ideas, that will be greatly appreciated.