Page 1 of 1

ValueList method

PostPosted: Tue Mar 28, 2017 11:35 am
by Robin.Lanneer
Hello

I am trying to use a Type Ahead with a valuelist. I'm using the global method of the valuelist: getDataSetForValueList(displayValue, realValue, record, valueListName, findMode, rawDisplayValue)

According to the default implementation / documentation, there are three cases: real and display params both null, only display is specified and only real is specified.
I understand the first two cases, but i don't understand how the third case is supposed to work / how i'm supposed to implement it.
Where does the realValue come from? SInce the user can only type in the displayValue in the Type Ahead.

Re: ValueList method

PostPosted: Tue Mar 28, 2017 12:27 pm
by patrick
The real value might already be set in the field. This is the case when you simply navigate to a record (not editing that field) that has a real value set and want to resolve that.

Re: ValueList method

PostPosted: Tue Mar 28, 2017 3:48 pm
by Robin.Lanneer
thank you for the answer,
so the third case isn't really used with a type Ahead.

Re: ValueList method

PostPosted: Tue Mar 28, 2017 6:37 pm
by patrick
Yes it is! When you navigate to a record that has a real value stored your user wants to see the display value for that! But obviously you don't have to load a whole list, but only need to resolve that one value. Maybe I'm not explaining that well. Let me try to explain the 3 cases again:

1. Nothing is in the field and the user has not typed anything yet (displayValue = null, realValue = null)

-> You want to return the whole list (at least as much as possible) and show that when the list drops down

2. Your user starts typing (displayValue != null)

-> only used for type aheads obviously, you want to return a filtered list

3. You have a real value in the field and the list you might have returned earlier doesn't return that

-> you want to make sure your user sees the display value for that real value

One example. You are in record A, user starts typing "A" and you return a list with everything beginning with A. User selects something from the list and Servoy internally holds that filtered list with all items starting with "A". Now you browse to the next record which has a real value that resolves to "B_something". He is not editing or anything, just looking at the record. The last value list you provided had everything beginning with "A", but we need to show "B_something" now. So you run into case 3.

I hope this makes it clearer?