Closed mcaisw closed 4 years ago
@mcaisw Not officially supported. But it can be implemented as follows.
public class Entity
{
public string Message; // Entity Data
public Entity(string message) => Message = message;
}
public class Row
{
public Entity[] Entities;
public Row(Entity[] entities) => Entities = entities;
}
public class ScrollView : FancyScrollView<Row>
{
void Start()
{
const int DataCount = 20;
const int ColumnCount = 3;
var rows = Enumerable.Range(0, DataCount)
.GroupBy(i => i / ColumnCount)
.Select(group => group
.Select(i => new Entity($"Entity {i}")).ToArray())
.Select(entities => new Row(entities))
.ToArray();
base.UpdateContents(rows);
}
}
public class RowCell : FancyScrollViewCell<Row>
{
public override void UpdateContent(Row row)
{
// Show row.Entities[] data
}
}
Hope adding this feature to subsequent updates. @setchi
@mcaisw Hi, Added Grid Layout demo.
Demo: https://setchi.jp/FancyScrollView/08_GridView Code: https://github.com/setchi/FancyScrollView/tree/master/Assets/FancyScrollView/Examples/Sources/08_GridView
Thanks.
Is it possible to creat a n columns m row scroll view