Hey guys, I’m buliding a checklist using tableview and checkbox widgets in my app. Apparently I need to save the checkbox value. I’m currently using GGData. I’m trying to use row.index to save and load value for each row, but it doesn’t work.
I’ll appreciate any help or sample checklist code. Thanks!
My code:
local list local checked = {} -- Handle row rendering local function onRowRender( event ) local phase = event.phase local row = event.row -- Load or Create settings box settings = GGData:new( "settings" ) settings:get( "checked{}") settings:save() --- if checkbox is touched local function onSwitchPress () settings:set("checked[row.index]", true) settings:save() end --onswitchpress local box = widget.newSwitch { style = "checkbox", onPress = onSwitchPress, initialSwitchState = settings:get("checked[row.index]") } end --onrowrender