lua - issue with list TableView in Corona -


am trying app in corona display list of topics/items in table view have been on over 2 weeks now, cant list displayed on app showing last item on list instead of listing on tableview

i have tried "listrec[event.index].name" in place of "listrec.name" getting error, please me see code below

    local widget = require( "widget" )     listrec = {}     local namedata =            {"system1","system2","system3","system4","system5","system6"     ,"system7","system8","system9"}     local list = nil      local function loaddata()      x=1, #namedata         listrec[x] = {}         listrec.name = namedata[x]         end     end      local function onrowrender( event )          -- reference row group         local row = event.row         local rowgroup = event.view          -- cache row "contentwidth" , "contentheight" because row bounds can change       children objects added         local rowheight = row.contentheight         local rowwidth = row.contentwidth          local rowtitle = display.newtext(row, listrec.name, 0, 0, nil, 35 )         rowtitle:setfillcolor( 0 )       -- align label left , vertically centered         rowtitle.anchorx = 0         rowtitle.x = 10      rowtitle.y = rowheight * 0.5      end --onrowrender       local function pageup()      -- create widget         tableview = widget.newtableview     {                top = 50,             height = screenheightsb,             width = screenwidth,             onrowrender = onrowrender,             onrowtouch = onrowtouch,             listener = scrolllistener     }      --heading outline         local heading = display.newtext("course outline", 0,0, "helvetica" or       "native.systemfont", 40)         heading.x = centerx     heading.y = 25     end ---pageup       local function showrec()         -- insert 40 rows         = 1, #listrec         local rowheight = 60          -- insert row tableview          tableview:insertrow{         rowheight = rowheight         }         end     end --- showrec      loaddata()     pageup()     showrec() 

you can modify code following:

local function loaddata()      x=1, #namedata         listrec[x] = {         name = namedata[x]         }         end     end 

then inside rowrender function add

 local idx = row.index  local rowtitle = display.newtext(row, listrec[idx].name, 0, 0, nil, 35 ) 

that should guess


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -