You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem showed up when multiple items in a List were getting the d-selected class. This was caused by deliteful/List#_createItemRenderer() calling delite/Selection#isSelected(renderItem), which
called delite/Store#getIdentity(renderItem), which returned undefined.
Why did getIdentity() return undefined? Because it was expecting a store item rather than a render item, and the render item and store item were storing the identity in a different property. The render item was {id: "foo"} whereas the corresponding store item was {value: "foo"}. (Note that the store had idProperty: "value".)
So the problem starts with delite/Store#getIdentity(item). The documentation doesn't specify whether item is a store item or a render item. But it's worse than that: sometimes getIdentity() is called on store items, and other times it's called on render items.
delite/StoreMap#itemToRenderItem() depends on getIdentity() working on store items.
Note that delite/Selection doesn’t seem to have an idea of the difference between store items and render items. And Combobox sets Selection#selectedItem to the renderItem. So Selection#getIdentity(item) should probably also take a renderItem. But Selection#getIdentity() and Store#getIdentity() are the same method because List extends both Store and Selection.
Finally, note that StoreMap#itemToRenderItem() hardcodes the render item's id property to be called id.
The text was updated successfully, but these errors were encountered:
This problem showed up when multiple items in a List were getting the
d-selected
class. This was caused bydeliteful/List#_createItemRenderer()
callingdelite/Selection#isSelected(renderItem)
, whichcalled
delite/Store#getIdentity(renderItem)
, which returnedundefined
.Why did
getIdentity()
return undefined? Because it was expecting a store item rather than a render item, and the render item and store item were storing the identity in a different property. The render item was{id: "foo"}
whereas the corresponding store item was{value: "foo"}
. (Note that the store hadidProperty: "value"
.)So the problem starts with
delite/Store#getIdentity(item)
. The documentation doesn't specify whetheritem
is a store item or a render item. But it's worse than that: sometimesgetIdentity()
is called on store items, and other times it's called on render items.delite/StoreMap#itemToRenderItem()
depends ongetIdentity()
working on store items.delite/Selection#isSelected(renderItem)
.delite/Selection#isSelected()
callsdelite/Store#getIdentity(renderItem)
.Note that
delite/Selection
doesn’t seem to have an idea of the difference between store items and render items. And Combobox setsSelection#selectedItem
to the renderItem. SoSelection#getIdentity(item)
should probably also take a renderItem. ButSelection#getIdentity()
andStore#getIdentity()
are the same method becauseList
extends bothStore
andSelection
.Finally, note that
StoreMap#itemToRenderItem()
hardcodes the render item'sid
property to be calledid
.The text was updated successfully, but these errors were encountered: