Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Problem inserting tableview into sceneGroup
Started by amirfl7 Oct 27 2017 01:00 PM

2 replies to this topic
tableview widget
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

amirfl7

[GLOBAL: userInfoPane.html]
amirfl7
  • Contributor

  • 136 posts
  • Corona SDK

I'm building a scene with composer that has a tableview in it.

Creating the tableview goes with no problem, but when I try to insert it into the sceneGroup, the app crashes with an error:

ERROR: table expected. If this is a function call, you might have used '.' instead of ':'

Here is my code, called inside scene:create():

-- create tableview
local tableView = widget.newTableView( {
        left = 0,
        top = 0,
        width = display.actualContentWidth,
        height = display.actualContentHeight,
        onRowRender = onRowRender,
        onRowTouch = onRowTouch,
        listener = scrollListener
})
-- Insert 40 rows
    for i = 1, 40 do
     
        local isCategory = false
        local rowHeight = 150
        local rowColor = { default={1,1,1}, over={1,0.5,0,0.2} }
        local lineColor = { 0.5, 0.5, 0.5 }

     
        -- Insert a row into the tableView
        tableView:insertRow(
            {
                isCategory = false,
                rowHeight = rowHeight,
                rowColor = rowColor,
                lineColor = lineColor
            }
        )
    end
    sceneGroup:insert(tableview)   -- <--APP CRASHES HERE


[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,641 posts
  • Corona SDK

Check your spelling.   Case matters. i.e. Lua is case-sensitive



[TOPIC: post.html]
#3

amirfl7

[GLOBAL: userInfoPane.html]
amirfl7
  • Contributor

  • 136 posts
  • Corona SDK

Thanks! can't believe i missed that




[topic_controls]
[/topic_controls]