"Remove context row(s) from Model" want to do to the opposite

I am using the actions framework on a table with global actions.

For the global action, I’d like to select a few rows with the checkbox, and have all of the other rows removed from the model. I have used the “Remove context row(s) from Model” action, and it does the opposite of what I am after.

Any way to have an action where it is essentially, “Remove all rows, except context row(s), from Model”?

This wouldn’t be hard with a little javascript. Create an Id= multiple values condition on your model. Then, have your action run javascript that:

  • gets the Ids of the selected rows, 
  • creates a semicolon-separated string of them, 
  • activates and set’s the value of your condition to that string, and 
  • query’s the model 

(you could use the action framework for the query step if that’s more comfortable for you).

This will help you get the selected rows: