Improve the valueToWidget function. Now the function can handle the full data array and the simple version.