我希望有人可以帮助我使用 PrimeVue DataTable 编辑模式。在 DataTable 的文档中指出
Row Editing is defined by setting
cellEdit
as "row", definingeditingRows
with the v-model directive to hold the reference to the editing rows and adding a row editor column to provide the editing controls. Note that sinceeditingRows
is two-way binding enabled, you may use it to initially display one or more rows in editing more or programmatically toggle row editing.
有人有关于如何使用 editingRows
以编程方式在新添加的行中切换编辑的工作示例吗?我尝试通过将新行的值插入 editingRows
数组来更新此变量,但这并没有改变页面上的任何内容(我尝试使用 nextTick),只是意味着当然后我手动触发了行编辑,我必须取消它两次才能清空数组。
最佳答案
对于遇到同样问题的任何人来说,事实证明解决方案非常简单,需要直接重新分配给 this.editingRows
- 我之前尝试使用 为其添加新值>推
。
这是我的做法(同时保持行 - 处于编辑模式 - 处于编辑模式):
this.editingRows = [...this.editingRows, this.newRow]
关于datatable - PrimeVue 编辑行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64605833/