[Vuejs]-How to display RadDataForm Valueproviders with key value pair

0👍

There was the problem with your data type. As per the documentation Array should have key and label properties. But still if you want id and name then you should try like below.

'valuesProvider': {
    key: 'id',
    label: 'name',
    items: [
      { id: 1121, name: 'Shanghai' },
      { id: 3651, name: 'Lagos' },
      { id: 5213, name: 'Moscow' },
      { id: 6214, name: 'São Paulo' },
      { id: 6985, name: 'Sydney' }
    ]
  };

https://docs.nativescript.org/vuejs/ns-ui/DataForm/dataform-editors-providers

Anyway, I tried that and that was not working for me either then searched for it and relaised that there is an open feature request to support the valuesProvider for picker from JSON metadata. You can vote to support the same feature.

https://github.com/NativeScript/nativescript-ui-feedback/issues/369

0👍

Solution

Just get you cityList out of vue data and map your data

https://play.nativescript.org/?template=play-vue&id=2oWObE&v=6

more detailed version with groups

https://play.nativescript.org/?template=play-vue&id=rqK7wO&v=3

Leave a comment