Is anyone else having this weird problem.
I create a tabelview and insert images into each row. This works fine until I scroll the view past these images. When I then go to scroll back up the tablerows. I get an error when my row renderer is trying to set the width of the row.
It appears from the error that the row’s image has been deleted from memory, even though the image is only inserted into the row but, is a field of a different object, which gliders debugger shows still exists. It seems the table is somehow deciding it has some idiotic right to delete whatever was inserted into it’s rows if the object becomes non-visible.
Here is the offending on render code. Note that this works fine the first time the rows are inserted but, not when scrolling back through the table. It then fails with the following error
local function onRowRender( event )
local row = event.row
print("row index " … row.id)
if Images[row.id] == nil then
return
else
if Images[row.id].background ~= nil then
Images[row.id].background.x = crossSaleAdverts[row.id].background.width / 2
Images[row.id].background.y = crossSaleAdverts[row.id].background.height / 2
Images[row.id].background.width = row.contentWidth
Images[row.id].background.height = row.contentHeight
row:insert(Images[row.id].background);
end
end
end
The error
stack traceback:
?: in function <?:218>
[C]: ?
/Users/petedwye/Library/Application Support/luaglider2/dev/ProjectBuilds/CrossSale(Builds)/CrossSale(default)/CrossSale/main.lua:54: in function ‘_onRowRender’
?: in function ‘_createRow’
?: in function ‘_manageRowLifeCycle’
?: in function <?:512>
?: in function <?:218>