is there an official way of getting a row like tableView._view._rows[i] ?

I read that tableView._view._rows[i] is undocumented and might be changed any time.

So is there another way of accessing the rows of a tableview for changing their backgrounds without rerendering the complete table?

Greetings,

Felix

Hi Felix,

How about using “getRowAtIndex()”?

http://docs.coronalabs.com/api/type/TableViewWidget/getRowAtIndex.html

Brent

Hei Brent,

thank you for your answer.

I did not know this function.

I think this is what I need, I just hope that

“This function will return nil if the row is not currently visible in the table view.”

does not make problems.

I ll give it a try, thanks again,

Felix

Hi Felix,

Yes, I see this may be a problem if you want to change the “content” of a row that’s not on the screen. Corona clears off-screen rows for memory efficiency, so if you call this function on a row that “doesn’t exist” you’ll get nil.

I can’t guarantee that “tableView._view._rows[i]” will remain forever, but most likely it will be retained, so I think you’d be fairly safe in continuing to use it.

Brent

Hi Felix,

How about using “getRowAtIndex()”?

http://docs.coronalabs.com/api/type/TableViewWidget/getRowAtIndex.html

Brent

Hei Brent,

thank you for your answer.

I did not know this function.

I think this is what I need, I just hope that

“This function will return nil if the row is not currently visible in the table view.”

does not make problems.

I ll give it a try, thanks again,

Felix

Hi Felix,

Yes, I see this may be a problem if you want to change the “content” of a row that’s not on the screen. Corona clears off-screen rows for memory efficiency, so if you call this function on a row that “doesn’t exist” you’ll get nil.

I can’t guarantee that “tableView._view._rows[i]” will remain forever, but most likely it will be retained, so I think you’d be fairly safe in continuing to use it.

Brent

Could you (Corona Labs) please add something like tableView.getRows() so that it’s more official?

I was looking at ways to resize the tableview on orientation change, and since setting width/height doesn’t do anything, the next thing I wanted to do was just recreate the tableview based on its current rows.

Pseudocode:

On orientation change,

recreate a tableview based on the original tableview’s properties, except for width/height which might be flip/flopped.  (An even better solution would be to allow the width/height to actually work.)

Then,

for each row in tableView.getRows()

    recreate each row based on the row’s own properties

end

Does that make sense? It allows building a generic ResizeTableView function.

Why not just delete all rows and then re-insert them?  I know that sounds like it’s more work, but its basically the under-the-hood steps that would needed to recreate the rows.

Rob

Could you (Corona Labs) please add something like tableView.getRows() so that it’s more official?

I was looking at ways to resize the tableview on orientation change, and since setting width/height doesn’t do anything, the next thing I wanted to do was just recreate the tableview based on its current rows.

Pseudocode:

On orientation change,

recreate a tableview based on the original tableview’s properties, except for width/height which might be flip/flopped.  (An even better solution would be to allow the width/height to actually work.)

Then,

for each row in tableView.getRows()

    recreate each row based on the row’s own properties

end

Does that make sense? It allows building a generic ResizeTableView function.

Why not just delete all rows and then re-insert them?  I know that sounds like it’s more work, but its basically the under-the-hood steps that would needed to recreate the rows.

Rob