i have db like this
db:exec[[
CREATE TABLE test (id INTEGER PRIMARY KEY, content);
INSERT INTO test VALUES (1, ‘Hello World’);
INSERT INTO test VALUES (2, ‘Hello Lua’);
INSERT INTO test VALUES (3, ‘Hello Sqlite3’)
]]
i’d like to select data from db then i’ll use tableView(list view) to generate rows with text and after click on the row then sent id to another scene
how can i do it please
local function onRowRender(event)
–initDb()
local row = event.row
local rowGroup = event.view
local label = “List Item”
local text = display.newText(row.id,0,0,native.systemFont,18) – how to change row.id direct to text
text.x = 160
text.y = row.height*0.5
text:setTextColor(0,0,0)
text:setReferencePoint(display.CenterLeftReferencePoint)
rowGroup:insert(text)
end
local listView = widget.newTableView{
–topPadding = 150,
width = 320, height= 440,
maskFile = “mask-320x448.png”
}
listView.y = 80
for row in db:nrows(“SELECT * FROM test”) do
listView:insertRow{
id = {row.content, – **** how can i send text to show on rows with id
height = 70,
onRender = onRowRender,
listener = onRowTouch(event),
lineColor = {23,204,98}
}
end
group:insert(listView)
**** is it possible at
listener = onRowTouch(event), i will have like listener = onRowTouch(event,id,text),
i try but it error
thank you very much [import]uid: 194215 topic_id: 33752 reply_id: 333752[/import]