b-table with input v-model
See original GitHub issueHello 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:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi @zaqpiotr, does this works as expected https://jsfiddle.net/cihkem/rv21gkju/ ?
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).