Use the first non-empty object to detect the label and value method for
grouped select

Fixes #978