I tried this several times many years ago. The grass gets soiled, and it attracts fruit flies. You can only give it for a few minutes a day, but the fruit flies are a pest. It would work better if the bottom can drain water like a plant pot and if you could store it outside starting from spring when it's not used. The grass starts to lay flat because of the piggies' weight.
Personally, I prefer small grass trays, and toss them when they are finished, as these get moldy in a couple of days.