# tableView deleteRow still not working after months

**URL:** <https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553>\
**Category:** Widgets\
**Created:** [October 3, 2013, 10:32am UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553 "2013-10-03T10:32:32Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 10:32am UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/1 "2013-10-03T10:32:32Z")

</div>

I keep getting this error when trying to delete a row from my tableView.&nbsp; This was reported back in July and still no fix.&nbsp; I NEED this fixed as I cannot release my app without it.

I am using a button and it tries to delete the row on release of the button.&nbsp; The button is not part of the tableView group.

Even the documentation code for deleteRow doesn’t work!

Runtime error  
?:0: attempt to index field ‘\_scrollBar’ (a nil value)  
stack traceback:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [C]: ?  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ?: in function \<?:1041\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (tail call): ?  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; …corona games\ps\favourites.lua:1139: in function ‘\_onRelease’  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ?: in function ‘?’  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ?: in funct

---

<div class="post-metadata">

**Author:** ![jonjonsson](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jonjonsson](https://forums.solar2d.com/u/jonjonsson)\
**Post date:** [October 3, 2013, 11:26am UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/2 "2013-10-03T11:26:19Z")

</div>

Is it something specific you are doing? After the tableView fixes few weeks back I have been deleting rows without problem.

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 1:30pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/3 "2013-10-03T13:30:28Z")

</div>

Hi Jon,

Here’s what I’ve found. Using windows simulator.

Having hideScrollBar = true, causes this error all the time.

If I have hideScrollBar = false, I can then only delete the row using a timer delay of 1.

The reason I need the hideScrollBar = true is because the scrollBar does not update if you add a new row to the table, which I’ve sent a bug report about last week.

I’m really stuck with this.

Here’s some sample code:

[lua]

local widget = require( “widget” )

local function onRowRender(event)  
&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp; &nbsp;local row = event.row  
&nbsp;&nbsp; &nbsp;local rowind = row.index  
&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp; &nbsp;local rownum = display.newText(row,"Row: "…rowind,20,20,native.systemFont,12)  
&nbsp;&nbsp; &nbsp;rownum:setTextColor(0)  
end

– Create a tableView  
local tableView = widget.newTableView  
{  
&nbsp;&nbsp;&nbsp; left = 0,  
&nbsp;&nbsp; &nbsp;top = 0,  
&nbsp;&nbsp;&nbsp; width = 320,  
&nbsp;&nbsp;&nbsp; height = 480,  
&nbsp;&nbsp;&nbsp; listener = tableViewListener,  
&nbsp;&nbsp; &nbsp;onRowRender = onRowRender,  
&nbsp;&nbsp; &nbsp;hideScrollBar = true,  
}

– Create 100 rows  
for i = 1, 100 do  
&nbsp;&nbsp;&nbsp; local isCategory = false  
&nbsp;&nbsp;&nbsp; local rowHeight = 40  
&nbsp;&nbsp;&nbsp; local rowColor =  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default = { 255, 255, 255 },  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; over = { 255, 0, 255 },  
&nbsp;&nbsp;&nbsp; }  
&nbsp;&nbsp;&nbsp; local lineColor = { 220, 220, 220 }

&nbsp;&nbsp; &nbsp;

&nbsp;&nbsp;&nbsp; – Insert the row into the tableView  
&nbsp;&nbsp;&nbsp; tableView:insertRow  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isCategory = isCategory,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowHeight = rowHeight,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowColor = rowColor,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lineColor = lineColor,  
&nbsp;&nbsp;&nbsp; }  
end

– Delete the tenth row in the tableView  
–local function deletetherow()  
&nbsp;&nbsp; &nbsp;tableView:deleteRow( 10 )  
–end

–timer.performWithDelay(1, deletetherow ,1)

[/lua]

---

<div class="post-metadata">

**Author:** ![jonjonsson](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jonjonsson](https://forums.solar2d.com/u/jonjonsson)\
**Post date:** [October 3, 2013, 1:36pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/4 "2013-10-03T13:36:07Z")

</div>

Ahh ok.&nbsp;I tried adding hideScrollBar = true to my project and delete a row and got the same error.

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 2:17pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/5 "2013-10-03T14:17:39Z")

</div>

Thanks Jon for confirming.

If coronalabs would update the scrollBar upon creating a new row then I wouldnt have to hide the scrollBar.

So trying to avoid one bug in tableView means I encounter a different bug which causes my tableView to be unworkable at the moment.

I’m very close to release and need either or both of these fixed please.

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [October 3, 2013, 3:51pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/6 "2013-10-03T15:51:29Z")

</div>

Is there a bug report number for this?

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 4:45pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/7 "2013-10-03T16:45:03Z")

</div>

> [@rob](#):
>
> Is there a bug report number for this?

Hi Rob,&nbsp; the bug report number is 26423 for the tableView scrollBar not updating after new rows are created.

Thanks

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [October 3, 2013, 5:11pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/8 "2013-10-03T17:11:17Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![SegaBoy](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/7c8e57/32.png) [@SegaBoy](https://forums.solar2d.com/u/SegaBoy)\
**Post date:** [October 10, 2013, 9:10pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/9 "2013-10-10T21:10:45Z")

</div>

Anybody know if this has been fixed yet? It seems to affect the deletion if you have .isLocked set on the tableView as well.

Build 1228

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [October 10, 2013, 11:47pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/10 "2013-10-10T23:47:09Z")

</div>

Do you have&nbsp; a bugID I could look up?

---

<div class="post-metadata">

**Author:** ![jonjonsson](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jonjonsson](https://forums.solar2d.com/u/jonjonsson)\
**Post date:** [October 3, 2013, 11:26am UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/11 "2013-10-03T11:26:19Z")

</div>

Is it something specific you are doing? After the tableView fixes few weeks back I have been deleting rows without problem.

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 1:30pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/12 "2013-10-03T13:30:28Z")

</div>

Hi Jon,

Here’s what I’ve found. Using windows simulator.

Having hideScrollBar = true, causes this error all the time.

If I have hideScrollBar = false, I can then only delete the row using a timer delay of 1.

The reason I need the hideScrollBar = true is because the scrollBar does not update if you add a new row to the table, which I’ve sent a bug report about last week.

I’m really stuck with this.

Here’s some sample code:

[lua]

local widget = require( “widget” )

local function onRowRender(event)  
&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp; &nbsp;local row = event.row  
&nbsp;&nbsp; &nbsp;local rowind = row.index  
&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp; &nbsp;local rownum = display.newText(row,"Row: "…rowind,20,20,native.systemFont,12)  
&nbsp;&nbsp; &nbsp;rownum:setTextColor(0)  
end

– Create a tableView  
local tableView = widget.newTableView  
{  
&nbsp;&nbsp;&nbsp; left = 0,  
&nbsp;&nbsp; &nbsp;top = 0,  
&nbsp;&nbsp;&nbsp; width = 320,  
&nbsp;&nbsp;&nbsp; height = 480,  
&nbsp;&nbsp;&nbsp; listener = tableViewListener,  
&nbsp;&nbsp; &nbsp;onRowRender = onRowRender,  
&nbsp;&nbsp; &nbsp;hideScrollBar = true,  
}

– Create 100 rows  
for i = 1, 100 do  
&nbsp;&nbsp;&nbsp; local isCategory = false  
&nbsp;&nbsp;&nbsp; local rowHeight = 40  
&nbsp;&nbsp;&nbsp; local rowColor =  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default = { 255, 255, 255 },  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; over = { 255, 0, 255 },  
&nbsp;&nbsp;&nbsp; }  
&nbsp;&nbsp;&nbsp; local lineColor = { 220, 220, 220 }

&nbsp;&nbsp; &nbsp;

&nbsp;&nbsp;&nbsp; – Insert the row into the tableView  
&nbsp;&nbsp;&nbsp; tableView:insertRow  
&nbsp;&nbsp;&nbsp; {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isCategory = isCategory,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowHeight = rowHeight,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rowColor = rowColor,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lineColor = lineColor,  
&nbsp;&nbsp;&nbsp; }  
end

– Delete the tenth row in the tableView  
–local function deletetherow()  
&nbsp;&nbsp; &nbsp;tableView:deleteRow( 10 )  
–end

–timer.performWithDelay(1, deletetherow ,1)

[/lua]

---

<div class="post-metadata">

**Author:** ![jonjonsson](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/ce73a5/32.png) [@jonjonsson](https://forums.solar2d.com/u/jonjonsson)\
**Post date:** [October 3, 2013, 1:36pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/13 "2013-10-03T13:36:07Z")

</div>

Ahh ok.&nbsp;I tried adding hideScrollBar = true to my project and delete a row and got the same error.

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 2:17pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/14 "2013-10-03T14:17:39Z")

</div>

Thanks Jon for confirming.

If coronalabs would update the scrollBar upon creating a new row then I wouldnt have to hide the scrollBar.

So trying to avoid one bug in tableView means I encounter a different bug which causes my tableView to be unworkable at the moment.

I’m very close to release and need either or both of these fixed please.

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [October 3, 2013, 3:51pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/15 "2013-10-03T15:51:29Z")

</div>

Is there a bug report number for this?

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [October 3, 2013, 4:45pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/16 "2013-10-03T16:45:03Z")

</div>

> [@rob](#):
>
> Is there a bug report number for this?

Hi Rob,&nbsp; the bug report number is 26423 for the tableView scrollBar not updating after new rows are created.

Thanks

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [October 3, 2013, 5:11pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/17 "2013-10-03T17:11:17Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![SegaBoy](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/s/7c8e57/32.png) [@SegaBoy](https://forums.solar2d.com/u/SegaBoy)\
**Post date:** [October 10, 2013, 9:10pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/18 "2013-10-10T21:10:45Z")

</div>

Anybody know if this has been fixed yet? It seems to affect the deletion if you have .isLocked set on the tableView as well.

Build 1228

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [October 10, 2013, 11:47pm UTC](https://forums.solar2d.com/t/tableview-deleterow-still-not-working-after-months/318553/19 "2013-10-10T23:47:09Z")

</div>

Do you have&nbsp; a bugID I could look up?
