Reputation: 78
I have a drop down which contains collection of objects. Drop down should bind by default based on condition
<tr v-for="item in binSalesList">\
<template v-if="item.IsRemovedBin != isRemoved">\
<td>{{item.LotteryBinId}}</td>\
<td>
<select v-model="item.UpcDescription" v-on:change="upcList_Click(item)">\
<option v-for="upc in upcList">{{ upc.UpcDescription }}</option>\
</td>\
<td>{{item.UPCPrice}}</td>\
<td>
<input type="textbox" v-model="item.TicketSoldQty" v-on:keyup="item.TicketSoldAmount=(item.TicketSoldQty*item.UPCPrice)" maxlength="4" size="4" onkeypress="app.checkIntegerValue();" />
</td>\
<td>
<input type="textbox" v-model="item.TicketSoldAmount" maxlength="4" size="4" onkeypress="app.checkIntegerValue();" />
</td>\
</template>\ </tr>\
Upvotes: 2
Views: 1499
Reputation: 81
You have to bind the data in the option tag. Please use the code below,
<option v-for="upc in upcList" v-bind:selected="A.column== B.column" :value="upc.column">{{ upc.column }}</option>
Upvotes: 2
Reputation: 61
try this
<select v-model="item.UpcDescription" v-on:change="upcList_Click(item)">\
<option v-for="upc in upcList"
v-bind:selected="upc.UpcDescription == item.UpcDescription"
:value="upc.UpcDescription">{{ upc.UpcDescription }}</option>
Upvotes: 2