lundi 28 septembre 2015

Corona show text from database in newScrollView

Im trying to pull some data from SQLite database to the Corona newScollView.

I managed to get data from the database in a tableView, so I thought the code should almost be the same for the newScrollView.

It keeps saying the row is empty, but its not. Any help?

Here is the code:

function scene:create( event )

local sceneGroup = self.view   

local function scrollListener( event )

    -- Get reference to the row group
    local row = event.row

    local options_metni = 
    {
        parent = row,
        text = row.params.Metni,
        x = 0,
        y = 0,
        font = native.systemFont,
        fontSize = 16
    }

    local metniObject = display.newText(options_metni)
    metniObject:setTextColor(0)
    metniObject.x = display.contentCenterX
end

---------------------
-- CREATE SCROLLVIEW
---------------------
local scrollView = widget.newScrollView
{
    left = 0,
    top = 0,
    width = display.contentWidth,
    height = display.contentHeight / 2,
    topPadding = 200,
    bottomPadding = 50,
    horiontalScrollDisabled = true,
    verticalScrollDisable = false,
    listener = scrollListener,
}
sceneGroup:insert(scrollView)


---------------------
-- GET DATA FROM DB
---------------------
for row in db:nrows("SELECT baslik FROM dua LIMIT 1") do

if row.data == nil then
    print(" NO DATA FOUND ")
end

    local rowParams = 
    {
        duaID       = row.dua_id,
        Metni       = row.baslik,
    }
end
end

Aucun commentaire:

Enregistrer un commentaire