Posted in: SPARK UI Toolkit Controls
Saroj PandaJanuary 20, 2017 at 9:01 am #3530
After looking at the issue mentioned by andy, I explored more to check the default selection using complex object (NameValuePair) and finding the component to behave extremly wierd.
First of all I’m really upset that we have wierd mapping of Display = value and Value = name defined as default and this starts making things complex.
Now if I need to set the defualt value for the single select, I have 2 options
- either use the string variable to set default value
- or use the same complex object(in this case NameValuePair) and define the appropriate name and value.
While using option 1, we can use the actual value of the options to set the default option.
BUT, when I tried option 2, which would be more common in case of complex object list, I had to set the value (Display) value same to the one I want as default selected. I tried to ignore the Display and only set name (Value) then there was no default selection.
It seems when using complex object as Binding, the default selection is happening by comparing the actual Display text and not the value behind it 🙁
As using the string variable we can use the value of the option we are continuing to use this approach and later if required we can calculate the selected item of the list.
Do you know if we are going to continue with this swapped mapping for Display(value) and Value(name). If so, is there any document which explains the clean understanding of this and how to set the binding variables (simple and complex both) to set the default values.
SarojSPARK SupportJanuary 20, 2017 at 12:35 pm #3532
Thank you for bringing this to our attention. We are currently investigating this issue and will provide more information in a timely fashion.
Stephen P.SPARK SupportJanuary 25, 2017 at 2:41 pm #3568
I am going to review this with the Development Team.
I have a Single Select bound to a complex object and list items from config of the same type containing a String str1 and Integer int1. The option display in Lookup Data Mapping is set to str1, and the option value is set to int1. With the bound variable default set to a matching value in the list int1 property, I can call me.setSelectedItem(me.getData().int1); in the On Load event to have the default value displayed.
It appears that me.setSelectedItem(me.getData()); will work as a work-around for simple list types, but the complex type needs to have the same property as the option value to correctly match the default display. I am adding this detail to the open issue we have for the simple type default value not showing on load.
You must be logged in to reply to this topic.