Hi last question for tonight, I’m trying to render the match results (string.find) in to a Row, with kinda works… but its only displaying the last match. so if i match ‘jan’ and ‘kevin’ it will; only list ‘kevin’
is there a way to fix this ?
code:
inputNumber = 1 check1 = 'jan' check2 = 'kevin' for i=1,#XMLdataTEST do local data1 = XMLdata[i].child[1].value local data2 = XMLdata[i].child[2].value local data3 = XMLdata[i].child[3].value local data4 = XMLdata[i].child[4].value input1 = string.lower( data1.. "" ) input2 = string.lower(\_G['check' .. inputNumber] ) input = input2 if string.find( input1.. "" , input ) then print(inputNumber.. " match with " ..input) inputNumber = inputNumber + 1 local function onRowRender( event ) local row = event.row local number = display.newText( row, "" .. row.index .. " - ", 12, 0, nil, 18 ) number:setReferencePoint( display.CenterLeftReferencePoint ) number.x = 15 number.y = row.height \* 0.5 number:setFillColor( 0, 0, 0 ) local name = display.newText(row, input1, 12, 0, nil, 18 ) name:setReferencePoint( display.CenterLeftReferencePoint ) name.x = number.x + number.contentWidth name.y = row.height \* 0.5 name:setFillColor( 0, 0, 0 ) local score = display.newText(row,"testy", 12, 0, nil, 18 ) score:setReferencePoint( display.CenterLeftReferencePoint ) score.x = display.contentWidth - score.contentWidth - 20 score.y = row.height \* 0.5 score:setFillColor( 0, 0, 0 ) end local tableView = widget.newTableView { left = 0, top = 0, height = display.contentHeight, width = display.contentWidth, onRowRender = onRowRender, onRowTouch = onRowTouch, listener = scrollListener } tableView.x = display.contentWidth + display.contentWidth/2 + 50 transition.to( tableView, { time=500, x=display.contentWidth / 2, transition=easing.inOutExpo } ) for i = 1, 1 do local isCategory = false local rowHeight = 40 local rowColor = { 255, 255, 255 } local lineColor = { 220, 220, 220 } tableView:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowColor = rowColor, lineColor = lineColor, onRender = onRowRender, } end end end