Skip to content

How fetchCallback works? #262

Answered by mskocik
Divinely5782 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, fetchCallback must return array of objects where every object must have property representing value (let's call it value) and text (this is label), which is being shown to users.
Svelecte automatically tries to pick following properties if they exist in option objects:

  • for value one of these properties is tried (in this order): ['id', 'value', 'ID']
  • for label this list is used: ['name', 'title', 'label']

So when we take your example option object, you don't need to do anything, because Svelecte should automatically use id property for value and name for label. If you would like to specify some other properties, you can use valueField and labelField properties to define which propert…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Divinely5782
Comment options

Answer selected by mskocik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants