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 2828 @change =" $emit('change', $event)"
2929 @end =" $emit('sort', items, $event)"
3030 >
31- <template v-for =" (item , itemIndex ) in items " >
31+ <template v-for =" (item , itemIndex ) in itemsWithIds " >
3232 <slot v-bind =" { item, itemIndex }" >
3333 <k-item
34- :key =" item.id ?? itemIndex "
34+ :key =" item.id"
3535 v-bind =" item"
36- :class =" { 'k-draggable-item': sortable && item.sortable }"
36+ :class =" { 'k-draggable-item': sortable && item.sortable !== false }"
3737 :image =" imageOptions(item)"
3838 :layout =" layout"
3939 :link =" link ? item.link : false"
4040 :selecting =" selecting"
4141 :selectable =" item.selectable"
42- :sortable =" sortable && item.sortable"
42+ :sortable =" sortable && item.sortable !== false "
4343 :theme =" item.theme ?? theme"
4444 :width =" item.column"
4545 @click =" $emit('item', item, itemIndex)"
@@ -140,6 +140,16 @@ export default {
140140 draggable: " .k-draggable-item"
141141 };
142142 },
143+ /**
144+ * Adds a unique id to each item if it doesn't have one
145+ * to be used for `:key` in the `v-for` loop
146+ */
147+ itemsWithIds () {
148+ return this .items .map ((item ) => ({
149+ ... item,
150+ id: item .id ?? item .uuid ?? this .$helper .uuid ()
151+ }));
152+ },
143153 table () {
144154 return {
145155 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