diff --git a/src/views/datatable/DataTableEditDemo.vue b/src/views/datatable/DataTableEditDemo.vue
index b80f6dbfc..116732c2c 100755
--- a/src/views/datatable/DataTableEditDemo.vue
+++ b/src/views/datatable/DataTableEditDemo.vue
@@ -16,12 +16,12 @@
-
+
-
+
@@ -38,7 +38,7 @@
-
+
@@ -47,10 +47,10 @@
Advanced Cell Editing
Custom implementation with validations, dynamic columns and reverting values with the escape key.
-
+
-
+
@@ -62,12 +62,12 @@
@row-edit-init="onRowEditInit" @row-edit-cancel="onRowEditCancel">
-
+
-
+
@@ -84,7 +84,7 @@
-
+
@@ -97,92 +97,89 @@
-<div class="card">
- <h5>Basic Cell Editing</h5>
- <p>Simple editors with v-model.</p>
- <DataTable :value="products1" editMode="cell" class="editable-cells-table">
- <Column field="code" header="Code">
- <template #editor="slotProps">
- <InputText v-model="slotProps.data[slotProps.column.field]" />
- </template>
- </Column>
- <Column field="name" header="Name">
- <template #editor="slotProps">
- <InputText v-model="slotProps.data[slotProps.column.field]" />
- </template>
- </Column>
- <Column field="inventoryStatus" header="Status">
- <template #editor="slotProps">
- <Dropdown v-model="slotProps.data['inventoryStatus']" :options="statuses" optionLabel="label" optionValue="value" laceholder="Select a Status">
- <template #option="slotProps">
- <span :class="'product-badge status-' + slotProps.option.value.toLowerCase()">{{slotProps.option.label}}</span>
- </template>
- </Dropdown>
- </template>
- <template #body="slotProps">
- {{getStatusLabel(slotProps.data.inventoryStatus)}}
- </template>
- </Column>
- <Column field="price" header="Price">
- <template #editor="slotProps">
- <InputText v-model="slotProps.data[slotProps.column.field]" />
- </template>
- </Column>
- </DataTable>
+<h5>Basic Cell Editing</h5>
+<p>Simple editors with v-model.</p>
+<DataTable :value="products1" editMode="cell" class="editable-cells-table">
+ <Column field="code" header="Code">
+ <template #editor="slotProps">
+ <InputText v-model="slotProps.data[slotProps.column.props.field]" />
+ </template>
+ </Column>
+ <Column field="name" header="Name">
+ <template #editor="slotProps">
+ <InputText v-model="slotProps.data[slotProps.column.props.field]" />
+ </template>
+ </Column>
+ <Column field="inventoryStatus" header="Status">
+ <template #editor="slotProps">
+ <Dropdown v-model="slotProps.data['inventoryStatus']" :options="statuses" optionLabel="label" optionValue="value" laceholder="Select a Status">
+ <template #option="slotProps">
+ <span :class="'product-badge status-' + slotProps.option.value.toLowerCase()">{{slotProps.option.label}}</span>
+ </template>
+ </Dropdown>
+ </template>
+ <template #body="slotProps">
+ {{getStatusLabel(slotProps.data.inventoryStatus)}}
+ </template>
+ </Column>
+ <Column field="price" header="Price">
+ <template #editor="slotProps">
+ <InputText v-model="slotProps.data[slotProps.column.props.field]" />
+ </template>
+ </Column>
+</DataTable>
</div>
<div class="card">
- <h5>Advanced Cell Editing</h5>
- <p>Custom implementation with validations, dynamic columns and reverting values with the escape key.</p>
- <DataTable :value="products2" editMode="cell" @cell-edit-complete="onCellEditComplete" class="editable-cells-table">
- <Column v-for="col of columns" :field="col.field" :header="col.header" :key="col.field">
- <template #editor="slotProps">
- <InputText :value="slotProps.data[slotProps.column.field]" @input="onCellEdit($event, slotProps)" />
- </template>
- </Column>
- </DataTable>
+<h5>Advanced Cell Editing</h5>
+<p>Custom implementation with validations, dynamic columns and reverting values with the escape key.</p>
+<DataTable :value="products2" editMode="cell" @cell-edit-complete="onCellEditComplete" class="editable-cells-table" >
+ <Column v-for="col of columns" :field="col.field" :header="col.header" :key="col.field">
+ <template #editor="slotProps">
+ <InputText :modelValue="slotProps.data[slotProps.column.props.field]" @update:modelValue="onCellEdit($event, slotProps)" />
+ </template>
+ </Column>
+</DataTable>
</div>
<div class="card">
- <h5>Row Editing</h5>
- <DataTable :value="products3" editMode="row" dataKey="id" :editingRows.sync="editingRows"
- @row-edit-init="onRowEditInit" @row-edit-cancel="onRowEditCancel">
- <Column field="code" header="Code">
- <template #editor="slotProps">
- <InputText v-model="slotProps.data[slotProps.column.field]" autofocus />
- </template>
- </Column>
- <Column field="name" header="Name">
- <template #editor="slotProps">
- <InputText v-model="slotProps.data[slotProps.column.field]" />
- </template>
- </Column>
- <Column field="inventoryStatus" header="Status">
- <template #editor="slotProps">
- <Dropdown v-model="slotProps.data['inventoryStatus']" :options="statuses" optionLabel="label" optionValue="value" laceholder="Select a Status">
- <template #option="slotProps">
- <span :class="'product-badge status-' + slotProps.option.value.toLowerCase()">{{slotProps.option.label}}</span>
- </template>
- </Dropdown>
- </template>
- <template #body="slotProps">
- {{getStatusLabel(slotProps.data.inventoryStatus)}}
- </template>
- </Column>
- <Column field="price" header="Price">
- <template #editor="slotProps">
- <InputText v-model="slotProps.data[slotProps.column.field]" />
- </template>
- </Column>
- <Column :rowEditor="true" headerStyle="width:7rem" bodyStyle="text-align:center"></Column>
- </DataTable>
-</div>
+<h5>Row Editing</h5>
+<DataTable :value="products3" editMode="row" dataKey="id" v-model:editingRows="editingRows"
+ @row-edit-init="onRowEditInit" @row-edit-cancel="onRowEditCancel">
+ <Column field="code" header="Code">
+ <template #editor="slotProps">
+ <InputText v-model="slotProps.data[slotProps.column.props.field]" autofocus />
+ </template>
+ </Column>
+ <Column field="name" header="Name">
+ <template #editor="slotProps">
+ <InputText v-model="slotProps.data[slotProps.column.props.field]" />
+ </template>
+ </Column>
+ <Column field="inventoryStatus" header="Status">
+ <template #editor="slotProps">
+ <Dropdown v-model="slotProps.data['inventoryStatus']" :options="statuses" optionLabel="label" optionValue="value" laceholder="Select a Status">
+ <template #option="slotProps">
+ <span :class="'product-badge status-' + slotProps.option.value.toLowerCase()">{{slotProps.option.label}}</span>
+ </template>
+ </Dropdown>
+ </template>
+ <template #body="slotProps">
+ {{getStatusLabel(slotProps.data.inventoryStatus)}}
+ </template>
+ </Column>
+ <Column field="price" header="Price">
+ <template #editor="slotProps">
+ <InputText v-model="slotProps.data[slotProps.column.props.field]" />
+ </template>
+ </Column>
+ <Column :rowEditor="true" headerStyle="width:7rem" bodyStyle="text-align:center"></Column>
+</DataTable>
import ProductService from '../../service/ProductService';
-import Vue from 'vue';
export default {
data() {
@@ -240,7 +237,7 @@ export default {
this.editingCellRows[props.index] = {...props.data};
}
- this.editingCellRows[props.index][props.column.field] = newValue;
+ this.editingCellRows[props.index][props.column.props.field] = newValue;
},
isPositiveInteger(val) {
let str = String(val);
@@ -353,7 +350,7 @@ export default {
this.editingCellRows[props.index] = {...props.data};
}
- this.editingCellRows[props.index][props.column.field] = newValue;
+ this.editingCellRows[props.index][props.column.props.field] = newValue;
},
isPositiveInteger(val) {
let str = String(val);