Missing rows in TableVie Widget

Hi

In my TableView I’m connecting to a SQLite database, which I use to populate the table with content. Now the last 4 lines are missing. I can see them only if the table is isBounceEnabled = true. I have checked my code several times for possible errors, but I cannot find it. Can anyone please help? I have the latest Corona build 2014.2189. 

-- Handle row rendering local function onRowRender( event ) local phase = event.phase local row = event.row local function subs(time, height, status, routeh) local t if ( dbRec[row.id].status == 1 ) then t = "top time: "..timeConversion(time) else t = "climbed: "..percentage( height, status, routeh ).."%" end return t end local rowTitleCopy = display.newText( row, dbRec[row.id].routeName, 0, 0, nil, fontTitle ) rowTitleCopy.x = row.x - ( row.contentWidth \* 0.5 ) + ( rowTitleCopy.contentWidth \* 0.5 ) + 14 rowTitleCopy.y = row.contentHeight \* 0.3-1 rowTitleCopy:setTextColor( 255,255,255 ) local rowTitle = display.newText( row, dbRec[row.id].routeName, 0, 0, nil, fontTitle ) rowTitle.x = row.x - ( row.contentWidth \* 0.5 ) + ( rowTitle.contentWidth \* 0.5 ) + 15 rowTitle.y = row.contentHeight \* 0.3 rowTitle:setTextColor( 244,0,0 ) local subTitle = display.newText( row, "made by: " .. dbRec[row.id].author, 0, 0, nil, fontSubmenu ) subTitle.x = row.x - ( row.contentWidth \* 0.5 ) + ( subTitle.contentWidth \* 0.5 ) + 15 subTitle.y = row.contentHeight - 24 subTitle:setTextColor( 90, 90, 90 ) local subTitle2 = display.newText( row, subs(dbRec[row.id].timeBest, dbRec[row.id].topHeight, dbRec[row.id].status, dbRec[row.id].routeH ), 0, 0, nil, fontSubmenu ) subTitle2:setReferencePoint( display.CenterRightReferencePoint ) subTitle2.x = row.contentWidth - 20 subTitle2.y = row.contentHeight - 24 subTitle2:setTextColor( 90, 90, 90 ) end -- Handle touches on the row local function onRowTouch( event ) local phase = event.phase if "release" == phase then storyboard.state.routeId = dbRec[event.target.index].routeId jsonCopy.saveTable(myGameSettings, "mygamesettings.json") storyboard.gotoScene( "scene3","slideLeft", 200) return true end end local options3 = { width = 20, height = 10, numFrames = 3, sheetContentWidth = 20, sheetContentHeight = 30 } local scrollBarSheet = graphics.newImageSheet( "images/scrollBar.png", options3 ) -- Create a tableView tableView = widget.newTableView { top = 100, left = 30, width = width-60, height = height - 150, backgroundColor = {248,236,199}, --maskFile = "assets/mask-320x366.png", listener = tableViewListener, noLines = true, --isBounceEnabled = false, rowTouchDelay = 250, --hideBackground = true, onRowRender = onRowRender, onRowTouch = onRowTouch, scrollBarOptions = { sheet = scrollBarSheet, --reference to the image sheet topFrame = 1, --number of the "top" frame middleFrame = 2, --number of the "middle" frame bottomFrame = 3 --number of the "bottom" frame }, } screenGroup:insert( tableView ) --print all the table contents for row in db:nrows("SELECT \* FROM main WHERE difficulty=" .. diff .. " ORDER BY climbed\_status, topHeight DESC") do idx = idx + 1 dbRec[idx] = {} dbRec[idx].routeId = row.route\_id dbRec[idx].routeName = row.route\_name dbRec[idx].difficulty = row.difficulty dbRec[idx].status = row.climbed\_status dbRec[idx].topHeight = row.topHeight dbRec[idx].count = row.count dbRec[idx].routeH = row.height dbRec[idx].timeBest = row.my\_time dbRec[idx].author = row.author print( "idx = ", idx ) local isCategory = false local rowHeight = rowSize local rowColor if ( dbRec[idx].routeId == 1 ) and ( myGameSettings.firstPlay ) then rowColor = { default = { 255,205,5 }, over = { 224, 213, 179 }, } else rowColor = { default = { 248,236,199 }, over = { 224, 213, 179 }, } end local lineColor = { 220, 220, 220 } tableView:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowColor = rowColor, id = idx, --lineColor = lineColor, } end

Hi,
I think I have the exact same problem. I’m creating a tableview and the last few rows are not visible, but they are there when I scroll down. The problem is that the tableview automatically bounces up a bit so i cant click them. Also when isBounceEnabled is set to false, I cant even scroll to the last rows.

I think the problem is that our lists don’t start from the top of the view. I tested it when the list started at the top of the view and all the rows displayed nicely.

I’m very interested in a fix for this…

Hi rick.slot,

so if you have started on the top of the view it worked OK with you? I’m missing like the last for rows.

Try the following in your tableView setup (aka constructor)

bottomPadding = 50,

You may need to adjust the value according to your needs.

Usual thing is that you set some Y value for the tableview and then the height is set too high and tableview goes off the screen.

Thank you for all the help ksan and jonjonsson. Had to set up 

bottomPadding = 400

and it works now.

This is not a soluttion as when you change the number off records it will require a different padding. It looks like a bug in table view. Did you manage duplicate this in one of the samples? Or make a simple project that demonstrates it without requiring DB so it can be ran as is. If you are able to do that I can look it over and see where the problem is.

He is setting the tableView height: height = height - 150,

But its not clear where “height” is coming from nor what the 150 is.  So I think the tableview is going off screen at the bottom and not a Corona bug. I recommend setting the height using display.contentHeight - headerHeight - footerHeight.

But yeah this is way too much code to post in forum, minimize to the problem so others can run it if at all possible and usually you will solve it during that process as well.

@jonjonsson You are 100% correct. I did not notice it while scanning the code.

To the OP: I think this is what you want when calling newTableView:

width = display.contentWidth - 60,
height = display.contentHeight - 150,

Sorry, I have tryed also this solution, but still having the same bug. The only thing that work for me is bottomPadding. This is the code I have tryed:

 tableView = widget.newTableView { top = 150, left = 30, width = display.contentWidth -60, height = display.contentHeight - 150, backgroundColor = {248,236,199}, --maskFile = "assets/mask-320x366.png", listener = tableViewListener, noLines = true, --isBounceEnabled = false, rowTouchDelay = 150, --bottomPadding = 400, --hideBackground = true, onRowRender = onRowRender, onRowTouch = onRowTouch, scrollBarOptions = { sheet = scrollBarSheet, --reference to the image sheet topFrame = 1, --number of the "top" frame middleFrame = 2, --number of the "middle" frame bottomFrame = 3 --number of the "bottom" frame }, }

I see you are using the old color values. What build are you on and are you using compatibility mode for graphics 1.0?

Is there anything on the bottom of the screen that migth be covering your table view?

Also try removing the scrollBarOptions and noLines and see if that fixes it.

Another thing you can try is to change your onRowRender to just insert a rect the size of the row or a simple fixed line of text and nothing else. Note this from the docs:

– Cache the row “contentWidth” and “contentHeight” because the row bounds can change as children objects are added
    local rowHeight = row.contentHeight
    local rowWidth = row.contentWidth

That is before you add anything.

It might be that some content or text is throwing it off. There are many posibilities here.

This solved my problem!

I’m still using graphics 1.0. It would have been a big mess to go 2.0 for my game. On the bottom I have a rectangle, which is covering a bit of the table, but the the last 4 rows are still out of the display. noLines = false did not help either nor removing the scrollBarOptions. 

For now only bottomPadding solves the trick.

I will try this one “Another thing you can try is to change your onRowRender to just insert a rect the size of the row or a simple fixed line of text and nothing else.” and let you know. Thank you for the help…

Hi,
I think I have the exact same problem. I’m creating a tableview and the last few rows are not visible, but they are there when I scroll down. The problem is that the tableview automatically bounces up a bit so i cant click them. Also when isBounceEnabled is set to false, I cant even scroll to the last rows.

I think the problem is that our lists don’t start from the top of the view. I tested it when the list started at the top of the view and all the rows displayed nicely.

I’m very interested in a fix for this…

Hi rick.slot,

so if you have started on the top of the view it worked OK with you? I’m missing like the last for rows.

Try the following in your tableView setup (aka constructor)

bottomPadding = 50,

You may need to adjust the value according to your needs.

Usual thing is that you set some Y value for the tableview and then the height is set too high and tableview goes off the screen.

Thank you for all the help ksan and jonjonsson. Had to set up 

bottomPadding = 400

and it works now.

This is not a soluttion as when you change the number off records it will require a different padding. It looks like a bug in table view. Did you manage duplicate this in one of the samples? Or make a simple project that demonstrates it without requiring DB so it can be ran as is. If you are able to do that I can look it over and see where the problem is.

He is setting the tableView height: height = height - 150,

But its not clear where “height” is coming from nor what the 150 is.  So I think the tableview is going off screen at the bottom and not a Corona bug. I recommend setting the height using display.contentHeight - headerHeight - footerHeight.

But yeah this is way too much code to post in forum, minimize to the problem so others can run it if at all possible and usually you will solve it during that process as well.