Yeah, in order for the input to be triggered, it needs to be grounded. You can ground two ways. The first being you daisy chain the grounds of each microswitch together, just link them and send them all to a common ground on your encoder. You could also use a terminal block, you'd just take all the grounds to the terminal block and run a wire to the ground on the encoder. Most people chose to do the first.