File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed
Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 3131 @change =" $emit('change', $event)"
3232 @end =" $emit('sort', items, $event)"
3333 >
34- <template v-for =" (item , itemIndex ) in items " >
34+ <template v-for =" (item , itemIndex ) in itemsWithIds " >
3535 <slot v-bind =" { item, itemIndex }" >
3636 <k-item
37- :key =" item.id ?? itemIndex "
37+ :key =" item.id"
3838 v-bind =" item"
39- :class =" { 'k-draggable-item': sortable && item.sortable }"
39+ :class =" { 'k-draggable-item': sortable && item.sortable !== false }"
4040 :image =" imageOptions(item)"
4141 :layout =" layout"
4242 :link =" link ? item.link : false"
4343 :selecting =" selecting"
4444 :selectable =" item.selectable"
45- :sortable =" sortable && item.sortable"
45+ :sortable =" sortable && item.sortable !== false "
4646 :theme =" item.theme ?? theme"
4747 :width =" item.column"
4848 @click =" $emit('item', item, itemIndex)"
@@ -143,6 +143,16 @@ export default {
143143 draggable: " .k-draggable-item"
144144 };
145145 },
146+ /**
147+ * Adds a unique id to each item if it doesn't have one
148+ * to be used for `:key` in the `v-for` loop
149+ */
150+ itemsWithIds () {
151+ return this .items .map ((item ) => ({
152+ ... item,
153+ id: item .id ?? item .uuid ?? this .$helper .uuid ()
154+ }));
155+ },
146156 table () {
147157 return {
148158 columns: this .columns ,
Original file line number Diff line number Diff line change 44 <div class =" k-table" >
55 <table >
66 <thead >
7- <th style =" width : 10rem " >Name</th >
8- <th style =" width : 10rem " >Type</th >
9- <th style =" width : 10rem " >Default</th >
10- <th >Description</th >
7+ <tr >
8+ <th style =" width : 10rem " >Name</th >
9+ <th style =" width : 10rem " >Type</th >
10+ <th style =" width : 10rem " >Default</th >
11+ <th >Description</th >
12+ </tr >
1113 </thead >
1214 <tbody >
1315 <tr v-for =" prop in props" :key =" prop.name" >
You can’t perform that action at this time.
0 commit comments