Add function to deal with button group click event