Vue-multiselect: using trackby on object

Created on 7 Apr 2018  路  5Comments  路  Source: shentao/vue-multiselect

API response returns an object with nested attributes for each option. How can I tell track-by to use an object property? i.e. track-by="attributes.language"

Example here:
https://jsfiddle.net/fy18zy9b/3/

<multiselect 
v-model="value" 
:options="options"
    :multiple="true"
    track-by="attributes.language"
    :custom-label="customLabel"
    >
  </multiselect>

Sample options:

[
  {
    attributes: 
    {
      language : 'JavaScript', 
      library: 'Vue.js'
    }
  },
  {
    attributes: 
    {
      language : 'JavaScript', 
      library: 'Vue-Multiselect'
    }
  },
  {
    attributes: 
    {
      language : 'JavaScript', 
      library: 'Vuelidate'
    }
  },
]
wontfix

Most helpful comment

+1

Would be great to have any prop 'customTrackBy' (Function => String) like 'customLabel' so as to work with any nested object

All 5 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This is still relevant

+1

Would be great to have any prop 'customTrackBy' (Function => String) like 'customLabel' so as to work with any nested object

+1

Any updates on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wujekbogdan picture wujekbogdan  路  4Comments

PrimozRome picture PrimozRome  路  3Comments

alexhyriavets picture alexhyriavets  路  3Comments

shsmad picture shsmad  路  3Comments

volkanciloglu picture volkanciloglu  路  3Comments