Polystyrene sulfonate is used as a potassium binder to treat hyperkalemia in traumatic rhabdomyolysis, acute and chronic kidney disease. It is listed as an ion-exchange resin that can also remove sodium or calcium from solution, but is also available in sodium salt or calcium salt form. How might this work?
Are you talking about Sodium Polystyrene Sulphonate (a.k.a SPS)?
If yes, then ...
Quoting from Chaitman, Dixit and Bridgeman (2016)
Synthetic cation-exchange resins are insoluble polymers resembling a crystalline lattice. When placed in a solvent, this structure swells, allowing the exchange of ions between the reactive group on the resin (in the case of SPS, sodium) and ions dissolved in the solvent.
However, other cations like sodium and calcium ions can bind too. As SPS moves through the intestine, sodium ions are released and exchanged for potassium ions.