Vue.js How to bind an element of the data array to a child components property? -
i using vue-tables show tabular data. trying extend vue-tables make cells in columns editable. therefore created vuejs child component called "editable-cell" able edit cell content. child component inserted vue-tables template editable column.
these vue-tables options:
headings: { title: 'title', description: 'description', createdby: 'created by', createdat: 'created at', updatedat: 'updated at', }, compiletemplates: true, // compile vue.js logic on templates. templates: { title: function(row) { return '<editable-cell row-id="'+row._id.$oid+'" key="title" value="'+row.title+'"></editable-cell>' },
currently passing plain string value of row.title
down child component.
my problem: when updated, data in parent component not changed. know two-way binding of properties :value.sync="..."
how do when want bind right element in parent data?
vue-tables passes row template function. how bind correct element in parent data array?
update managed create jsfiddle shows problem: https://jsfiddle.net/doogie/nvmt0vd7/
i found 1 possible solution: when pass object down child component, passed by-reference. means when child component updates properties of object, changes immideately visible in parants data.
so pass down whole row each editable-cell. can update property/value in row.
Comments
Post a Comment