Using Table View

Hello!

I’m using the example code from the table view widget and when I use the code below, I get the following error:

Corona Simulator Runtime error

File: ?
Attempt to compare number with string

stack traceback:
    ?: in function <?:512>
    ?: in function <?:218>

The only difference between my code and the example code is that I added the tableView widget. What gives?

tableView = widget.newTableView{ &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;top = 0, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;height = "300" &nbsp;&nbsp; &nbsp;} &nbsp;&nbsp; &nbsp;-- Insert 40 rows &nbsp;&nbsp; &nbsp;for i = 1, 40 do &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; local isCategory = false &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; local rowHeight = 36 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; local rowColor = { default={ 1, 1, 1 }, over={ 1, 0.5, 0, 0.2 } } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; local lineColor = { 0.5, 0.5, 0.5 } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; -- Make some rows categories &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if ( i == 1 or i == 21 ) then &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isCategory = true &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowHeight = 40 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowColor = { default={ 0.8, 0.8, 0.8, 0.8 } } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lineColor = { 1, 0, 0 } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; end &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; -- Insert a row into the tableView &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; tableView:insertRow( &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isCategory = isCategory, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowHeight = rowHeight, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowColor = rowColor, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lineColor = lineColor, &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; params = {}&nbsp; -- Include custom data in the row &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; ) &nbsp;&nbsp; &nbsp;end

height is supposed to be a number and you have quotes around it making it a string.

Rob

D’oh!

height is supposed to be a number and you have quotes around it making it a string.

Rob

D’oh!