coreui/coreui-vue

CSmartTable template not getting index and change value with v-model not working

lunwhl opened this issue · 2 comments

  • macOS v11.2.3
  • Chrome v106.0.5249.119

<CSmartTable :active-page="3" column-filter column-sorter @column-filter-change="testColumnFilter" :columns="columns" header :items-per-page="5" items-per-page-select @items-per-page-change="testItemPerPageChange" :items="items" @active-page-change="testPageChange" :table-props="{ striped: true, hover: true, }" > <template #status="{ item, index }"> <td> <CFormInput type="text" @keyup="changeStatus(item, index)" v-model="item.status" /> </td> </template> </CSmartTable>

`setup() {
const columns = [
{
key: 'name',
_style: { width: '40%' },
},
'registered',
{ key: 'role', _style: { width: '20%' } },
{ key: 'status', _style: { width: '20%' }, filter: false },
{
key: 'show_details',
label: '',
_style: { width: '1%' },
filter: false,
sorter: false,
},
]
const items = [
{id: 0, name: 'John Doe', registered: '2018/01/01', role: 'Guest', status: 'Pending'},
];

    const changeStatus = (item, index) => {
        console.log('changeStatus index: ', index);
    }

    return {
        columns,
        items,
        changeStatus
    }
},`

console.log show "undefined" for the index.
v-model only update the data in input but not the CSmartTable data

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions