Set select source to function

Can set source to a function that returns either the array format or object format.