Lazy loading data in LookupField from select query

Hi,

I have a lookup Field and i want to populate list of project codes into the LookupField using select query from my database.
Since the number of records for a particular project type is exceeding 10000 items, the time take for all the data items to load into the LookupField is almost half a minute thereby increasing page view time.

Can anyone tell me how to go about this with lazy loading where during initial page load i can populate few data items and once the page is loaded all the data items gets populated in the LookupField.

You suggestions would be really helpful to me.

Thankyou

Hi,

  1. You can use background tasks: Background Tasks - CUBA Platform. Developer’s Manual
    In the background run() method - load 10000 items. In the done() method - use LookupField.setOptionsList() to change options.

  2. The better solution is to use another UI component - SuggestionField: SuggestionPickerField - CUBA Platform. Developer’s Manual
    With that component you will be able to filter infinite list of options by search string in the database, without loading too much data on the backend.

1 Like