Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 4 Support (Qt 6) › JsonModel

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25455

    Alexander

    Hello, please tell me how to do it correctly?  I’m trying to execute a function at startup, with local data JSON everything works, when trying to work with data from firebase it doesn’t, but if I call this function, for example, from a button after loading the project, then with firebase everything works

    import Felgo
    import QtQuick

    App {

    AppPage {
    id: page

    readonly property var dataSource1: fireBaseDataModel.shoppingItems1 || {}

    // property with json data
    property var jsonData: [
    {
    “id”: 1,
    “title”: “Entry 1”
    },
    {
    “id”: 2,
    “title”: “Entry 2”
    },
    {
    “id”: 3,
    “title”: “Entry 3”
    }
    ]

    // list model for json data
    JsonListModel {
    id: jsonModel

    source: page.jsonData // dataSource1 – model from FireBase

    keyField: “id”

    function prepare(){

    jsonModel.setProperty(0,”title”,”Hello”)

    }
    }
    // list view
    AppListView {
    anchors.fill: parent
    model: jsonModel
    delegate: SimpleRow {
    text: model.title

    }

    }

    Component.onCompleted: jsonModel.prepare()

    }

    }

     

    #25467

    Bence
    Felgo Team
    #25481

    Alexander

    Thanks for the tip, everything worked out!

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded