q-input in q-table keeps resetting to 0



  • I’m trying to put a q-input in one of the columns of a q-table. However, every time the q-input loses focus, the value that I keyed in is deleted and reset to 0 (the field works fine if I only click the spinner buttons and do not type in the field, though). How can I stop this from happening?

    Code below:

    <template #body-cell-quantity="{row}">
    	<q-td>
    		<q-input type="number" v-model.number="row.quantity" min="0"/>
    	</q-td>
    </template>
    


  • @walfin
    I guess there’s something weird elsewhere in your code.

    Tried to reproduce with the basic q-table example from the docs, and it works :

    https://codepen.io/cp-tof06/pen/xxwrLzq



  • @tof06 You are right.

    I have solved the problem.

    The reason was that I was loading the table data using axios and I did not use this.$set, which resulted in the variable not being reactive.

    Thanks!


Log in to reply