Okay, I think I’ve found the culprit. That being said, I don’t know how to fix it.
I wasn’t passing the parameters to the onRowRender Function because of it’s placement in the code. I moved it and tested it with print statements and I’m getting all my variables populating inside the onRowRender Function. However, no dice on getting the Table to populate. So doing some further digging I found an issue with the display.newText function which reads:
The newText() object uses a mask when the object is created. Since there is a nested mask limit of three on all platforms, care must be taken when inserting text into acontainer, ScrollView, or TableView (these also consume a mask unit). If you exceed the mask nesting limit, the text may appear as a solid white block.
As far as I can tell I’m just getting white blocks like the GOTCHAS section describes.
But I have no idea how to fix the issue with the little documentation provided. I have tried only populating the id, removing all un required fields, etc. But no luck.
Here is my code for anyone who thinks they have an answer. Thanks in advance.
[lua]–TABLE VIEW OF DATABASE
-------------------------------------------------------
– HANDLE TABLEVIEW ROW RENDERING
-------------------------------------------------------
local function onRowRender ( event )
local row = event.row
print(row.params.id)
print(row.params.capture)
print(row.params.timeDate)
– common row elements
local font = native.systemFont
local fontSize = 24
local rowHeight = row.height / 2
– display.newText options
local options_id = {
parent = row,
text = row.params.id,
x = 50,
y = rowHeight,
font = font,
fontSize = fontSize,
}
– add row object
row.id = display.newText ( options_id )
row.id.anchorX = 0
--row.id:SetFillColor( 1, 0, 0 )
– display.newText options
local options_capture = {
parent = row,
text = row.params.capture,
x = 100,
y = rowHeight,
font = font,
fontSize = fontSize,
}
– add row object
row.capture = display.newText ( options_capture )
row.capture.anchorX = 0
--row.capture:SetFillColor( 1, 0, 0 )
– display.newText options
local options_timeDate ={
parent = row,
text = row.params.timeDate,
x = 200,
y = rowHeight,
font = font,
fontSize = fontSize,
}
– add row object
row.timeDate = display.newText ( options_capture )
row.timeDate.anchorX = 0
--row.timeDate:SetFillColor( 1, 0, 0 )
end
-------------------------------------------------------
–
– CREATE TABLEVIEW WIDGET
–
-------------------------------------------------------
local table_options = {
top = _H * 0.5,
left = _W * 0.05, – 1/2 of the remainder of the Window
width = _W * 0.9, – 90% of the window width
height = _H * 0.4,
listener = tableViewListener,
backgroundColor = { 0.95, 0.95, 0.95 },
onRowRender = onRowRender,
}
local tableView = widget.newTableView( table_options )
-------------------------------------------------------
–
– RETREIVE DATABASE DATA
–
---------------------------------------------------------
for row in db:nrows(“SELECT * FROM input”) do
------------------------------------------------
– TESTING READING OF DATABASE ELEMENTS
– print(row.id)
– print(row.capture)
– print(row.timeDate)
------------------------------------------------
--Parameter lua table
local rowParams = {
id = row.id,
capture = row.capture,
timeDate = row.timeDate
}
--Add tableView rows
tableView:insertRow(
{
rowHeight = 50,
params = rowParams,
}
)
end[/lua]