|
Post by meneleus on Sept 11, 2021 16:01:21 GMT
Greetings,
I would like to color the background of my data in an odd/even design. However, it seems that dataIndex is always 0. Are the fields in EnhancedScrollerCellView never initialized?
As a workaround I did the following:
insert code here
public virtual EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) {
MoveItemView cellView = scroller.GetCellView(cellViewPrefab) as MoveItemView;
cellView.SetMove(dataList[dataIndex]);
cellView.dataIndex = dataIndex;
cellView.cellIndex = cellIndex;
return cellView;
}
Is this what is meant for me to do? I don't see the "active" flag set either btw.
Thanks
|
|
|
Post by meneleus on Sept 11, 2021 17:03:53 GMT
Actually, that still didn't work, the dataIndex just gets cleared. I had to just add the data index into my SetMove call...
|
|
|
Post by echo17 on Sept 11, 2021 20:56:02 GMT
The dataIndex of the cell is set once the active cell range is available. This step happens after the GetCellView method is called on all cells visible, so if you are needing the dataIndex inside your SetMove method, then you'll need to pass the value (like you discovered in the second post).
I'll look into ways to make the dataIndex available sooner, but for now you can just pass the value and use it that way.
|
|