how can i send some var or parameter into onRowTouch() for tableView

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]

Normally the way I do this is I have a separate table that holds my data and that each row of data corresponds to a row in the listView.

data = {}  
data[1] = {}  
data[1].first\_name = "Fred"  
data[1].last\_name = "Flintstone"  
data[2] = {}  
data[2].first\_name = "Wilma"  
data[2].last\_name = "Flintstone"  
data[3] = {}  
data[3].first\_name = "Pebbles"  
data[3].last\_name = "Flintstone"  
  
local function onRowRender(event)  
 local row = event.row  
 local rowGroup = event.view  
 local id = event.row.id  
  
 local text = display.newText(data[id],0,0,native.systemFont,18)  
 ...  
end  

Or something like that. [import]uid: 199310 topic_id: 33752 reply_id: 134229[/import]

thank you very much i’ll try [import]uid: 194215 topic_id: 33752 reply_id: 134298[/import]

lua (and typeless languages in general) makes it pretty easy to just glom things onto other things… You could just jam the data in somewhere during your render, and pick the data up again in your touch listener… Sure it’s messy. But it also pretty easy.

 -- In your onRowRender function...  
 --  
 local row = event.target  
 row.FILELOCATION = imageLink.FILELOCATION -- Save off in arbitrary spot....  

[code]
– In your onRowTouch listener…

local row = event.target
myFunction(row.FILELOCATION) – pass the saved data somewhere else…
[/code] [import]uid: 79933 topic_id: 33752 reply_id: 134303[/import]

Normally the way I do this is I have a separate table that holds my data and that each row of data corresponds to a row in the listView.

data = {}  
data[1] = {}  
data[1].first\_name = "Fred"  
data[1].last\_name = "Flintstone"  
data[2] = {}  
data[2].first\_name = "Wilma"  
data[2].last\_name = "Flintstone"  
data[3] = {}  
data[3].first\_name = "Pebbles"  
data[3].last\_name = "Flintstone"  
  
local function onRowRender(event)  
 local row = event.row  
 local rowGroup = event.view  
 local id = event.row.id  
  
 local text = display.newText(data[id],0,0,native.systemFont,18)  
 ...  
end  

Or something like that. [import]uid: 199310 topic_id: 33752 reply_id: 134229[/import]

thank you very much i’ll try [import]uid: 194215 topic_id: 33752 reply_id: 134298[/import]

lua (and typeless languages in general) makes it pretty easy to just glom things onto other things… You could just jam the data in somewhere during your render, and pick the data up again in your touch listener… Sure it’s messy. But it also pretty easy.

 -- In your onRowRender function...  
 --  
 local row = event.target  
 row.FILELOCATION = imageLink.FILELOCATION -- Save off in arbitrary spot....  

[code]
– In your onRowTouch listener…

local row = event.target
myFunction(row.FILELOCATION) – pass the saved data somewhere else…
[/code] [import]uid: 79933 topic_id: 33752 reply_id: 134303[/import]