build 2013.1137
Hello everybody,
I’m newbie and I trying to import data in (myList = tableView.newList).
This code works fine
data[1] = {} data[1].title = "Title 1" data[1].image = "myImage1.png" data[2] = {} data[2].title = "Title2" data[2].image = "myImage2.png" myList = tableView.newList { data = data, default="listItemBg.png", over="listItemBg\_over.png", onRelease=listButtonRelease, callback=function(item) local g = display.newGroup() local img = display.newImage(item.image) g:insert(img) img.x = math.floor(img.width\*0.5 + 6) img.y = math.floor(img.height\*0.5) local t = display.newText(item.title, 0, 0, native.systemFontBold, 16) g:insert(t) t:setTextColor(0, 0, 0) t.x = math.floor(t.width/2) + 160 t.y = 46 return g end }
If I import data from DB like this, I just have the title, but not the image
local data = {} local i = 1 for row in db:nrows(sql) do data[i] = row.title data[i] = row.image i = i + 1 end myList = tableView.newList{ data=data, default="listItemBg.png", over="listItemBg\_over.png", onRelease=listButtonRelease, callback=function(row) local t = display.newText(row, 0, 0, native.systemFontBold, 16) t:setTextColor(0, 0, 0) t.x = math.floor(t.width/2) + 12 t.y = 46 return t end }
any help would be appreciated.
thanks
Giuseppe