question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

b-table with input v-model

See original GitHub issue

Hello Everyone!

I’m trying to use 2 way binding with input in b-table, when I’m changing value inside of input, data combined with v-model is not changed it’s read only but I want to change it. Can any body help me?

 <template>
                <b-table :fields="fields" :items="position.cut">
                    <template slot="index" slot-scope="data">
                        {{data.index + 1}}
                    </template>
                    <template slot="count" slot-scope="data">
                            <input
                                class="form-control"
                                type="text"
                                v-model="data.value"


                        />
                    </template>
                </b-table>
            </template>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mosinvecommented, Feb 6, 2018

hi @zaqpiotr, does this works as expected https://jsfiddle.net/cihkem/rv21gkju/ ?

0reactions
tmorehousecommented, Mar 8, 2019

That is because each character typed updates the underlying table data (which is reactive) which in turn causes the table to re-render. Avoid modifying the table data in place. The input should be modifying a separate variable copy of the item row data. And once editing is complete then update the table row in a single update.

To help minimize re-rendering, set a primary key column in your items array, and instruct b-table to use this column as the rendered tr key (vue key).

Read more comments on GitHub >

github_iconTop Results From Across the Web

changing a single value using v-model / full table is redrawn
In the example below, when changing the value in the input, the whole table is redrawn, and the ifFunction() function is trigged 4...
Read more >
Table component, input, span and v-model - Laracasts
I am creating a table component with Vue that has properties like the URL where it gets the data, the update/delete URL to...
Read more >
V-for and v-model in a loop of inputs - Get Help - Vue Forum
Hi ! I would like to display a table with some inputs in each rows. I get my data from my API and...
Read more >
Adding a new todo form: Vue events, methods, and models
Binding data to inputs with v-model. Next up, we need a way to get the value from the form's <input> so we can...
Read more >
Data table component - Vuetify
Data tables. The v-data-table component is used for displaying tabular data. Features include sorting, searching, pagination, content-editing, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found