how would I add a default value to this template. the default value would be the first option in the list which is 'Please Select...'
<template #dropDownSelection="{ props }">
<td colspan="1">
<select
id="IvrElementId"
v-model="props.dataItem[props.field]"
@change="inputChanged(props)"
>
<option
v-for="option in findFilterOptions(props.field)"
:key="option.Value"
:value="option.Value"
>
{{ option.Text }}
</option>
</select>
</td>
</template>
this is the response.data
0: {Text: 'Please Select...', Value: '0', Description: null, Selected: false, Active: false, …}
1: {Text: 'Hang Up Start (Default) (Default Page)', Value: '2', Description: null, Selected: false, Active: false, …}
2: {Text: 'Hold Start (Default) (Default Page)', Value: '1', Description: null, Selected: false, Active: false, …}
3: {Text: 'VQ Start (Virtual Queue Page)', Value: '6', Description: null, Selected: false, Active: false, …}
Thanks for this, turns out I just needed to include this on my addRecord method...
addRecord: function () {
const dataItem = {
inEdit: true,
changed: true,
Active: true,
//0 = Please Select...
CampaignId: 0,
IvrId: 0,
ListId: 0,
TagIds: []
};
What about
<option
v-for="option in findFilterOptions(props.field)"
:key="option.Value"
:value="option.Value"
:selected="option.Value === '0' ? 'selected' : null"
>
{{ option.Text }}
</option>
You could also set the selected attr in option 0 to true and use that one instead of option.Value