LoopGridViewItem OnGetItemByRowColumn(LoopGridView gridView, int itemIndex, int row, int column) { //get the data to showing ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemIndex); if (itemData == null) { return(null); } /* * get a new item. Every item can use a different prefab, * the parameter of the NewListViewItem is the prefab’name. * And all the prefabs should be listed in ItemPrefabList in LoopGridView Inspector Setting */ LoopGridViewItem item = gridView.NewListViewItem("ItemPrefab0"); ListItem18 itemScript = item.GetComponent <ListItem18>();//get your own component // IsInitHandlerCalled is false means this item is new created but not fetched from pool. if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init();// here to init the item, such as add button click event listener. } //update the item’s content for showing, such as image,text. itemScript.SetItemData(itemData, itemIndex, row, column); return(item); }
LoopGridViewItem OnGetItemByRowColumn(LoopGridView gridView, int itemIndex, int row, int column) { ItemData itemData = DataSourceMgr.Get.GetItemDataByIndex(itemIndex); if (itemData == null) { return(null); } LoopGridViewItem item = gridView.NewListViewItem("ItemPrefab0"); ListItem19 itemScript = item.GetComponent <ListItem19>(); if (item.IsInitHandlerCalled == false) { item.IsInitHandlerCalled = true; itemScript.Init(); } itemScript.SetItemData(itemData, itemIndex, row, column); return(item); }