Help .. Table View get ItemID (not RowID)

Hi there,
i am using tableViewXL.lua 1.0 from Gilbert Guerrero.

i can easy get through the “listButtonRelease” function what ROW i selected.

But how would i get an information about the Item thats attached to the row?

I add Data like:
function add_data(id, userid, title,subtitle,image, more)
myData[id] = {}
myData[id].title = title
myData[id].subtitle = subtitle
myData[id].image = image
myData[id].id = id
myData[id].moreimg = more
myData[id].userid = userid
myData[id].category = “Dinner”
end
that comes assigned to the new TableView

myList = tableView.newList{
data=myData,

Now i tried to get for example my my data[id].userid in

function listButtonRelease( event )
self = event.target
local id = self.id

with self.userid
but it looks the event is just assigned to the rows itself and not the items bellow.

Any idea how to get my item.userid without creating a separate Table just to
assign row.id with a userid?

thx
chris
[import]uid: 4795 topic_id: 15094 reply_id: 315094[/import]

oh really, i don’t know why always i post a question and than 5 mins later i find the answer.
It may because writing the question does help my brain to puzzle the things together :slight_smile:

ok simple, i just have to assign the row i got with the row.id from the tableview after release:

function listButtonRelease( event )
self = event.target
local id = self.id
print (myData[id].userid) – < just that :slight_smile:
end
i keep it as usually for anyone who feels sometimes same stupid trapped like me :slight_smile:

greets
chris

[import]uid: 4795 topic_id: 15094 reply_id: 55839[/import]

Guruk! Hello!

Well done on solving the problem yourself and thank you for sharing the solution, I’m sure others will find it useful as well :slight_smile:

Peach [import]uid: 52491 topic_id: 15094 reply_id: 55856[/import]

is there a way to extract the subtitle text…its easy to get the titleText.text but i cant seem to find the equivalent for the subtitle text?? if this is a dumb question i apologize in advance … [import]uid: 85717 topic_id: 15094 reply_id: 56849[/import]

what do you mean with extracting the subtitle text?

in the callback function ( callback = function( row ) )
its just defined

local subtitle = display.newText( row.subtitle, 0, 0, native.systemFont, 24 )
subtitle:setTextColor(150,150,150)
g:insert(subtitle)

if you like to know how to extract it in the

function listButtonRelease( event )
than its same like above

function listButtonRelease( event )
self = event.target
local id = self.id
print (myData[id].subtitle) – < just that :slight_smile:
end
chris
[import]uid: 4795 topic_id: 15094 reply_id: 56863[/import]

somehow i don’t get it :slight_smile:

i guess you define your table like:

myData[1].title = title
myData[1].subtitle = subtitle
myData[2].title = title
myData[2].subtitle = subtitle

right?

so you would just need to know the id and ask for the the value.
the id you get from

function listButtonRelease( event )
self = event.target
local id = self.id

print (myData[id].subtitle)

or where , how do you define your subtitle?

maybe some more code would be helpful

greets
chris
btw. i am also on mac :slight_smile: [import]uid: 4795 topic_id: 15094 reply_id: 56934[/import]

Chris, thank for the response , however im using
function listButtonRelease( event )
self = event.target
local id = self.id
print (myData[id].subtitle) – < = table: 0x281ccd0
end

and all it produces is a table reference of some kind when i would like to have the text from the subtitle of the cell

i can get the title back as text using event.target.titleText.text

but there does not seem to be a way for me to get the subtitle text back…Im on a Mac maybe that makes a difference
UPDATE:
print(myData[id].subtitle.label) this works!! thanks for pointing me in the right direction altho technically speaking im accessing the data from my own array and not directly from the table itsself…

[import]uid: 85717 topic_id: 15094 reply_id: 56928[/import]

UPDATE:
print(myData[id].subtitle.label) this works!! thanks for pointing me in the right direction altho technically speaking im accessing the data from my own array and not directly from the table itsself… [import]uid: 85717 topic_id: 15094 reply_id: 56937[/import]

anyhow… good you got it work… thats the main thing :slight_smile:

i am also glad about so many good help i got here in the forum!

cheers
chris
[import]uid: 4795 topic_id: 15094 reply_id: 56943[/import]