Problem with radio buttons being unclickable

I have this app, which contains 37 rows with 3 grouped radio buttons in each.

The default for these button groups is that the middle column button (#2) is the active one.

I have a reset button, which resets all radio buttons back to the default setting (the middle column buttons).

The problem:  if a user selects a large number of buttons from either the left or right columns, and then resets the radio buttons, he is unable to interact with some of the buttons in the left or right column.

Example: I check off the 20 first buttons in the right column and then reset. All buttons return to the middle column. However, for the first 7 rows, I can no longer click the right column.

The bug is present in both simulator and on device.

Some code!
Here, the 37x3 radio buttons are created. I insert all middle column buttons into an empty array, so that I can turn them on when resetting later on.

for j = 1, #tableRoles do emptyDisplay[j] = display.newGroup() scrollView:insert(emptyDisplay[j]) local thisState=0 for a in db:nrows("SELECT state FROM test WHERE nr="..tostring(j)) do thisState=tonumber(a.state) end for i = 1, 3 do local startsOn = false if i==thisState then startsOn=true end if i==1 then radioButtonSheetColor=radioButtonSheetGreen elseif i==2 then radioButtonSheetColor=radioButtonSheetOrange elseif i==3 then radioButtonSheetColor=radioButtonSheetRed end empty[i] = widget.newSwitch { left = -22+i\*32, top = -35+(j\*35), style = "radio", id = idCount..i, width=27, height=27, initialSwitchState = startsOn, onPress = filterRole, sheet=radioButtonSheetColor, frameOff=1, frameOn=2 } emptyDisplay[j]:insert(empty[i]) if i==2 then table.insert(radioButtons,empty[i] ) end end local roleName = display.newText(options2) roleName:setTextColor( 0.8, 0.8, 0.2 ) roleName.text=tableRoles[j] if tableRoles[j]=="Extra Werewolf" or tableRoles[j]=="Vampire" or tableRoles[j]=="Sorcerer" or tableRoles[j]=="Wolf Cub" or tableRoles[j]=="Minion" or tableRoles[j]=="Lone Wolf" then roleName:setFillColor(0.8,0.2,0.2) end roleName.y=-21+(j\*35) scrollView:insert(roleName) idCount=idCount+1 end

Here is the reset function. It loops through the radioButtons array and sets them all to ON. Visually, the radio buttons indeed all turn to their middle setting, but you can no longer interact with the right column buttons.

local function resetFilters(event) for i=1, #initialSettings-2 do local q = [[UPDATE test SET state=2 WHERE nr=']]..i..[[';]] db:exec( q ) end for i=1, #radioButtons do radioButtons[i]:setState({isOn=true}) tableFilterStates[i]=2 end end

Finally, here is the function that is called when a radio button is clicked. I did a print, and the function does not get called when trying to click a bugged radio button:

local function filterRole( event ) local switch = event.target local role=(switch.id:sub(1,2))-9 local state=tonumber(switch.id:sub(3)) tableFilterStates[role]=state local q = [[UPDATE test SET state=']]..state..[[' WHERE nr=']]..role..[[';]] db:exec( q ) end

Step 1: I tick off the first 20 right column radio buttons in the app:

UNNQxBw.png

Step 2: I hit the Reset button:

h3zlfaD.png

Step 3: I can no longer check off the first 7 right column buttons (but the rest work fine)

XwzIVYg.png