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
Suppose a Column component with 10 children, from which only 4 are created, and the rest are stored in the _lazyItems array, if you navigate to the 8th element directly (with no animations) by setting column.selectedIndex = 8, the column will truncate the index and focus on the last one that was created, the 4th one.
We made a workaround while the issue is addressed here.
import{Lightning}from'@lightningjs/sdk'import{ColumnasLngColumn}from'lightning-ui-components'import{getW}from'lightning-ui-components/utils'import{clamp}from'../../Utils'exportdefaultclassColumnextendsLngColumn{// Add lazy items as needed to reach the desired indexsetlazyIndex(index: number){if(index<0)returnif(this._lazyItems&&this._lazyItems.length>0&&index>=this.items.length){constitemsLength=this.items.lengthconstlazyItemsLength=this._lazyItems.lengthconsttotalLength=itemsLength+lazyItemsLengthconstindexClamped=clamp(index,0,totalLength-1)constlazyItemCount=indexClamped-itemsLength+1+this.lazyUpCountconstlazyItemCountClamped=clamp(lazyItemCount,0,lazyItemsLength)constlazyItems=this._lazyItems.splice(0,lazyItemCountClamped)index=indexClampedthis._appendItems(lazyItems)}this.selectedIndex=index}// Append items without adding them to the _lazyItems array_appendItems(items: Lightning.Component[]=[]): void{constitemWidth=this.renderWidththis._smooth=falseitems.forEach(item=>{item.parentFocus=this.hasFocus()item=this.Items.childList.a(item)item.w=getW(item)||itemWidth})this.stage.update()this._update()this._refocus()}}
The text was updated successfully, but these errors were encountered:
Suppose a Column component with 10 children, from which only 4 are created, and the rest are stored in the
_lazyItems
array, if you navigate to the 8th element directly (with no animations) by settingcolumn.selectedIndex = 8
, the column will truncate the index and focus on the last one that was created, the 4th one.We made a workaround while the issue is addressed here.
The text was updated successfully, but these errors were encountered: