Hi
I’m trying to insert some categories into my TableView like so;
[lua]
for i=1,400 do
if i == 2 then
myList:insertRow{
rowHeight = 30,
isCategory = true,
rowColor = {default={ 255,0,0 }, over={ 255, 0, 0, 1 }},
lineColor = {default={ 0, 0, 0 }, over={ 0, 0, 0, 1 }},
}
elseif i == 307 then
myList:insertRow{
rowHeight = 30,
isCategory = true,
rowColor = {default={ 255,0,0 }, over={ 255, 0, 0, 1 }},
lineColor = {default={ 0, 0, 0 }, over={ 0, 0, 0, 1 }},
}
else
myList:insertRow{
rowHeight = 60,
isCategory = false,
rowColor = {default={ 255, 255, 255 }, over={ 205, 255, 255, 1 }},
lineColor = {default={ 0, 0, 0 }, over={ 0, 0, 0, 1 }},
}
end
end
[/lua]
However, I do not know what to do in my onRowRender function - currently I have this situation:
[lua]
local function onRowRender( event )
--Set up the localized variables to be passed via the event table
local row = event.row
local id = row.index
if id == 2 then – id = 2 is a category as defined in my for loop
–
else
nameText = display.newText(person[id].name, 20, 0, native.systemFontBold, 18 )
nameText:setTextColor(0,0,0)
nameText.y = 20
phoneText = display.newText( person[id].phone, 20, 0, native.systemFont, 18 )
phoneText:setTextColor( 0,0,0 )
phoneText.y = 40
end
return true
end
[/lua]
However, the 2nd item in my table is not dealt with and this means that I’m missing data. I tried without the if condition, but that caused my table data to be added to the category row.
Sorry if that’s not clear, I’m happy to clarify if necessary
Thanks
max