I have an app that contains a list of newSwitch (checkbox style) entries in a tableView widget. However when I choose one of the entries and proceed to scroll the tableView to where the newSwitch is off the screen, the checkbox disappears, it is however still selected and the entry is still entered in upon submission. This happens in both iOS and Android. I have attached some code, maybe I am just approaching this from the wrong angle.
*cheers
This code just registers that the newSwitch is selected
-- Handle press events for the checkbox local function onSwitchPress( event ) local switch = event.target if switch.isOn == false then itemID = string.gsub(itemID, "---" .. tostring(switch.id), "") elseif switch.isOn == true then itemID = itemID .. "---" .. tostring(switch.id) end end
This code displays the newSwitch and tableView
--- newSwitch Widget local onOffSwitch = widget.newSwitch { left = 250, top = 200, style = "checkbox", id = dataId, onPress = onSwitchPress, } onOffSwitch.x = display.contentWidth - 50 onOffSwitch.y = row.height / 1.9 row:insert(onOffSwitch) --- tableView widget local tableView = widget.newTableView { backgroundColor = {0}, hideBackground = true, top = 15, left = 10, width = display.contentWidth - 20, height = display.contentHeight - 170, onRowRender = onRowRender, onRowTouch = onRowTouch, listener = scrollListener } for i = 1, maxRows do tableView:insertRow { rowHeight = 50, isCategory = false, rowColor = { default = { 255, 255, 255, 0 } }, lineColor = { default = { 0.90, 0.90, 0.90 } } } end group:insert(tableView)