I have a large string table that I’m successfully searching. Unfortunately, my tableview still populates the missing cells, any advice? I figure I’m going to have to alter the actual tableview.lua in order to prevent it from spawning the buttons, but I’m not sure where/how to make the change.
myList = tableView.newList{
data=data,
default="listItemBg.png",
--default="listItemBg\_white.png",
over="listItemBg\_over.png",
onRelease=listButtonRelease,
top=topBoundary,
bottom=bottomBoundary,
cat="body",
order=headers,
categoryBackground="catBg.png",
callback = function( row )
local isFiltered = false
filterText = inputsearch
if( filterText ~= "" ) then
if( string.find(string.lower( row.title ) , string.lower( filterText )) ) then
isFiltered = false
globalvarinput=1
else
isFiltered = true
globalvarinput=0
end
end
-- if( isFiltered == true) then
-- data=data+1
-- end
local g = display.newGroup()
if( isFiltered == false ) then
local img = display.newImage(row.image)
g:insert(img)
img.x = math.floor(img.width\*0.5 + 1)
img.y = math.floor(img.height\*0.5)
local title = display.newText( row.title, 0, 0, native.systemFontBold, 24 )
title:setTextColor(0, 0, 0)
--title:setTextColor(255, 255, 255)
g:insert(title)
title.x = title.width\*0.5 + img.width + 6
title.y = 30
local subtitle = display.newText( row.subtitle, 0, 0, native.systemFont, 20 )
subtitle:setTextColor(80,80,80)
--subtitle:setTextColor(180,180,180)
g:insert(subtitle)
subtitle.x = subtitle.width\*0.5 + img.width + 15
subtitle.y = title.y + title.height + 6
local subtitle2 = display.newText( row.subtitle2, 0, 0, native.systemFont, 20 )
subtitle2:setTextColor(80,80,80)
--subtitle:setTextColor(180,180,180)
g:insert(subtitle2)
subtitle2.x = subtitle2.width\*0.5 + img.width + 15
subtitle2.y = title.y + title.height + 30
local origin = display.newText( row.origin, 0, 0, native.systemFont, 20 )
origin:setTextColor(0,0,0)
--subtitle:setTextColor(180,180,180)
g:insert(origin)
origin.x = origin.width\*0.5 + img.width + 30
origin.y = title.y + title.height + 80
local bprice = display.newText( row.bprice, 0, 0, native.systemFontBold, 20 )
bprice:setTextColor(0,0,0)
--subtitle:setTextColor(180,180,180)
g:insert(bprice)
bprice.x = bprice.width\*0.5 + img.width + 400
bprice.y = title.y + title.height + 80
local gprice = display.newText( row.gprice, 0, 0, native.systemFontBold, 20 )
gprice:setTextColor(0,0,0)
--subtitle:setTextColor(180,180,180)
g:insert(gprice)
gprice.x = gprice.width\*0.5 + img.width + 400
gprice.y = title.y + title.height + 55
else
--tableView:deleteRow()
--tableView:removeItem(self, true)
--if(myList.numChildren -1 == 0) then
--print("No more btn in the list")
--end
counter=counter+1
print(counter)
end
return g
end
}
[import]uid: 77043 topic_id: 36095 reply_id: 336095[/import]