Custom Text Data Change with Type Ahead?

Forum to discuss the new web client version of Servoy.

Custom Text Data Change with Type Ahead?

Postby john1598360627 » Sat Feb 20, 2021 3:49 am

By default it seems that the Type Ahead element allows for the user to ONLY select text that is within a dataprovider already, aka select only options from the drop down. Is it possible to enter in custom text as well? As in, a datachange of that record.

You know, like how a Google search has both a type ahead AND allows you to put whatever text you want.
john1598360627
 
Posts: 21
Joined: Tue Aug 25, 2020 3:03 pm

Re: Custom Text Data Change with Type Ahead?

Postby sean » Mon Feb 22, 2021 7:58 pm

Hi John,

It depends on the type of ValueList being used.
If the display value and the real value are the same, then you can just capture the input in the onDataChange.

However, it is common that the datatype is often different, i.e.
Dog|1
Cat|2
Mouse|3

The the TypeAhead will not accept input for values that don't fall within the list.
For this case you can use a Global Method Value List. This is quite a bit more work, as you determine by keystrokes what the display and real value should be, but you have full control.

A 3rd option could be that you add a list item which indicates a response designated for more action. i.e.
Dog|1
Cat|2
Mouse|3
Other...|4

Then trap it on data change to check it

Hope this helps.

Best,
Sean
Software Engineer
Servoy USA
sean
 
Posts: 287
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Custom Text Data Change with Type Ahead?

Postby john1598360627 » Wed Feb 24, 2021 12:30 am

Thanks Sean for the reply, but I was curious about this point.

The the TypeAhead will not accept input for values that don't fall within the list.
For this case you can use a Global Method Value List. This is quite a bit more work, as you determine by keystrokes what the display and real value should be, but you have full control.


What do you mean by 'Global Method Value list'? The reason I ask is because if there was a way to make a singular global method to change ANY type aheads into the typeahead/textbox hybrid that would be great.
john1598360627
 
Posts: 21
Joined: Tue Aug 25, 2020 3:03 pm

Re: Custom Text Data Change with Type Ahead?

Postby sean » Wed Feb 24, 2021 11:12 pm

Hi John,

I meant the type of the valuelist is global method (i.e. custom, global method, table, related)
Don't think it is possible to have a global way to accept new values into valuelists / type ahead.

The most common approach is what I shared before, inject a value into your list which is something like "Add new item..." then handle the data change to intercept it.

You could file a feature request, it's not a bad idea, but that might be tricky to get right w/o affecting many other API and events of components and data. We could take a look.
Software Engineer
Servoy USA
sean
 
Posts: 287
Joined: Mon May 21, 2007 6:26 pm
Location: USA


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 2 guests