Default Value
The Default Value feature allows you to pass pre-selected items to the component, making it particularly useful in scenarios like an edit page, where you need to display previously chosen values. The primary key and the values provided as an array to the default value must align correctly to ensure the component functions as expected.
The
defaultValue
prop is optional and should be used only if you have initial values that need to be pre-filled in the component. Code Snippet
<SearchSelect
:data='pseudoEmployeeData'
placeholderName='Employee'
displayKey='firstName lastName | employeeId'
v-model='value'
primaryKey='employeeId'
:defaultValue='[00001, 0003, 0004]'
/>
Please note, the values being passed into the "defaultValue" property must match the "primaryKey" of the component. i.e employeeId in this scenario is our "primaryKey" so, the keys being passed as default values must be that of employee Id.