What about creating a module variable for your tableView?
Something like:
local myTV; local onRowRender = function(event) if (event.name == "rowRender") -- use myTV to access any properties end end myTV = widget.newTableView(......, onRowRender=onRowRender);
I need a reference, not upvalues. My ORR function, my data rows, and my TV object are created in entirely different places and thus I can’t (and don’t want to) do this with upvalues. Think clean OOP…
Thanks for the suggestion though.
Someone at Corona please show me how to get a reference to the final parent of the row
I use the Lua Glider IDE for my Corona development. With it I set a breakpoint inside the ORR and inspected the variables for ‘event’, and saw the ‘target’ there.
I did the same for ORT and there’s a ‘target’ there too, but for some reason it points to the same object as ‘row’.
Thanks Alex—really appreciate the answer. Will you guys be adding documentation for the event records being passed?? Also, I thought I heard v2 was also going open-source. When will that happen?
“event.target.parent._data” is not working for me inside of onRowTouch (ORT)
Here is what I’m doing:
local tv = widget.newTableView(tableParams)
tv._data = data – keep ref to the data passed
inside of ORT, I try:
local rowData = event.target.parent._data[event.row.index]
and I get:
attempt to index field ‘_data’ (a nil value)
I just downloaded the newest daily build so I know it’s not a version problem…about to dig through the source code now
ok, here is the problem:
from line 394 in widget_tableview.lua, you have:
local newEvent =
{
phase = “release”,
target = event.target,
row = self._targetRow,
}
event.target != tableview
and the row (self._targetRow) doesn’t have any attribute pointing to it’s parent either
I can fix my version but then I void the warrantee ;-)
feedback requested!!
Thx,
D
PS please use a function to create the event record so it’s consistent throughout the module and does not need to be edited in 6 different places…thanks, you guys rock!