Correctly unselect trade row when another bar is clicked

This commit is contained in:
Matthias 2020-09-03 07:27:03 +02:00
parent 9cf812eef1
commit 764c9e59b7

View File

@ -42,7 +42,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'; import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { namespace } from 'vuex-class'; import { namespace } from 'vuex-class';
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -84,6 +84,15 @@ export default class TradeList extends Vue {
selectedItemIndex? = undefined; selectedItemIndex? = undefined;
@Watch('detailTradeId')
watchTradeDetail(val) {
const index = this.trades.findIndex((v) => v.trade_id === val);
// Unselect when another tradeTable is selected!
if (index < 0) {
this.$refs.tradesTable.clearSelected();
}
}
get rows(): number { get rows(): number {
return this.trades.length; return this.trades.length;
} }