[solved] QInput + QTable + v-model - Update DB when field change is submited
-
I’d like to send a changed value from edited column to a database only if QInput field in QTable is changed. But v-model is updated with every input change - doesn’t matter if I use property to show SET and CANCEL buttons for QInput.
How should I send a changed value to database only if the field is changed (editted field is submited with enter or with SET if buttons are visible)?
<q-popup-edit v-model="props.row.FIELD_TO_CHANGE"> <q-field> <q-input v-model="props.row.FIELD_TO_CHANGE" /> </q-field> </q-popup-edit>
I tried .lazy with v-model but it has no influence.
-
Solution is simple. If I read the documentation not only for table but also for popup edit:
<q-popup-edit @save="updateFiled" buttons v-model="props.row.FIELD_TO_CHANGE"> <q-field> <q-input v-model="props.row.FIELD_TO_CHANGE"/> </q-field> </q-popup-edit>
-
Still not perfect. How can I pass an information about a row in datatable? @Save has only old and new value. But I need to update a row in a table.
-
solution:
@save="updateField(props.row)"
-
nice, usually the doc is helpful enough, just require some more reading and checking the source of the samples in there or the framework helps as well.