Error when deleting row in TableView - widget v2.0

hello everyone, I’m using Corona 2013.1135, I have a problem when deleting row in table View. To know the number of rows in my table View, I used list:getNumRows().

Here is my code :

[lua]
display.setStatusBar( display.HiddenStatusBar ) 

– Import the widget library

local widget = require( “widget” )

local list

–Create a group to hold our widgets & images

local widgetGroup = display.newGroup()

– Handle row rendering

local function onRowRender( event )

    local row = event.row

    

    local rowTitle = display.newText( row, "List item " … row.index, 0, 0, native.systemFontBold, 16 )

    rowTitle.x = row.x - ( row.contentWidth * 0.5 ) + ( rowTitle.contentWidth * 0.5 ) + 10

    rowTitle.y = row.contentHeight * 0.5

    rowTitle:setTextColor( 0, 0, 0 )

end

– Hande row touch events

local function removeRowTouch( event )

    local phase = event.phase

    local row = event.target

    

    if “release” == phase or phase == “tap” then

        print("before calling deleteRow() - number of rows: " … list:getNumRows())

        list:deleteRow(row.index)    

        print("after calling deleteRow() - number of rows: " … list:getNumRows())     

        print("")

    end

end

– Create a tableView

list = widget.newTableView

{

    top = 0,

    width = 320, 

    height = 448,

    onRowRender = onRowRender,

    onRowTouch = removeRowTouch,

}

– insert rows into list (tableView widget)

for i = 1, 20 do

    list:insertRow{

        height = 72,

    }

end

–Insert widgets/images into a group

widgetGroup:insert( list )
[/lua]

Case 1: 

I print the number of rows before and after delete row from table View. But there’s not thing change in the number of rows:

    2013-06-07 16:18:51.211 Corona Simulator[54690:707] Pressed row: 5

    2013-06-07 16:18:51.302 Corona Simulator[54690:707] number of rows: 20

    2013-06-07 16:18:51.303 Corona Simulator[54690:707] number of rows: 20

    2013-06-07 16:18:53.096 Corona Simulator[54690:707] Pressed row: 8

    2013-06-07 16:18:53.176 Corona Simulator[54690:707] number of rows: 20

    2013-06-07 16:18:53.177 Corona Simulator[54690:707] number of rows: 20

    2013-06-07 16:18:54.715 Corona Simulator[54690:707] Pressed row: 10

    2013-06-07 16:18:54.839 Corona Simulator[54690:707] number of rows: 20

    2013-06-07 16:18:54.842 Corona Simulator[54690:707] number of rows: 20

Case 2:    

When I touch the the row #5, the terminal shows me: 

    2013-06-07 16:22:50.175 Corona Simulator[54690:707] Pressed row: 5

    2013-06-07 16:22:50.290 Corona Simulator[54690:707] number of rows: 20

    2013-06-07 16:22:50.291 Corona Simulator[54690:707] number of rows: 20

    

After that, I try to delete the row #4, I get the following error: 

    ?:0: attempt to index field ‘?’ (a nil value)

    stack traceback:

        [C]: ?

        ?: in function <?:983>

        (tail call): ?

        ?: in function <?:172>

        ?: in function <?:218>

well then this is it,I think there is something wrong in the API “deleteRow()” I hope you can help me. I’m developing a company application and this is very important because in it.

thanks in advance

Sames problems with my tableView. deleleRow “high to low” cause that error

Hi,

This looks like a bug.

Could you please file a bug report?

Thanks,

Alex

I filed a similar bug report back in may, 24th.

 (Case 23678) Issue with deleting and adding row in tableview

@borgb i was just about to post that i found a similar case.

Ok, looking into this.

Thanks,

Alex

Sames problems with my tableView. deleleRow “high to low” cause that error

Hi,

This looks like a bug.

Could you please file a bug report?

Thanks,

Alex

I filed a similar bug report back in may, 24th.

 (Case 23678) Issue with deleting and adding row in tableview

@borgb i was just about to post that i found a similar case.

Ok, looking into this.

Thanks,

Alex