Hi All,
I have a dilemma similar to this other thread, but specifically with regards to the tableViewXL by Gilbert: http://developer.anscamobile.com/forum/2010/08/05/how-pass-additional-arguments-parameters-event-listener
Basically I have my data that gets passed through to create the list. When you select an item in the list it transitions through to another page to show more content, works great. I target the relevent information row content using the same method in the examples posted by Ansca by getting the row id through event.target.id:
[lua]–create single page view using the tableview row id in listButtonRelease
local function showDetails(detailID)
singleScreenText = display.newText(data[detailID].subtitle), 0, 0, “ClarendonBT-Bold”, 13)
end
–click function when selecting the row get the row id
local function listButtonRelease(event)
–self = event.target
local detailID = event.target.id
showDetails(detailID)
end
–list
myList = tableView.newList{
data=data,
default=“list-item.png”,
over=“list-item-over.png”,
onRelease=listButtonRelease,
top=49,
bottom=49,
rowSize=44,
–backgroundColor={ 128, 128, 128 },
callback = function( row )
local g = display.newGroup()
print(row.title)
local glossaryName = display.newText( row.title, 0, 0, system.nativeFont, 14 )
glossaryName:setTextColor(255,255,255)
g:insert(glossaryName)
glossaryName:setReferencePoint(display.CenterLeftReferencePoint);
glossaryName.x = 20
glossaryName.y = 22
return g,glossaryName
end
}[/lua]
My problem is I reorder this content through a search function and output the results as data for it to delete and then repopulate the list, effectively showing only the search results. Again this works perfectly. My problem is that the row id’s assigned through the event.target.id are now different because the list is only showing the returned results and not the original list. The results have been resorted and the single page content will not match up to what it is supposed to.
I am trying to get around this by assigning my own numbered id to the data table so it outputs the true id if I print it in the callback function. This is working, but I need to somehow pass that parameter through to the listButtonRelease function so I can use it instead of the event.target.id.
Hope that makes sense! Thanks in advance! [import]uid: 69160 topic_id: 14904 reply_id: 314904[/import]