No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    q-input in q-table keeps resetting to 0

    Framework
    2
    3
    509
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      walfin last edited by

      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>
      
      T 1 Reply Last reply Reply Quote 0
      • T
        tof06 @walfin last edited by

        @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

        1 Reply Last reply Reply Quote 0
        • W
          walfin last edited by

          @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!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post