omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    How to Connect Table View Methods to UI Builder (Storyboard)

    Pythonista
    2
    2
    1355
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • GroundhogDayLoop
      GroundhogDayLoop last edited by

      How would I go about connecting table view methods from the (.py) code file, for example, to the actual table view built in the UI Builder section (.pyui)? I would also like to set the rows text in the code instead of the storyboard section.

      I set the delegate and data source but maybe I'm missing a detail in that regard. I thought maybe I could assign the class to a part of the UI (.pyui) but not sure.

      Thanks.

      Phuket2 1 Reply Last reply Reply Quote 0
      • Phuket2
        Phuket2 @GroundhogDayLoop last edited by

        @GroundhogDayLoop, using the ui.View you assign to your .pyui file you can access the ui.Table by the name you give it in the builder.
        Eg

        v = ui.load_view('my_view.pyui')
        tbl = v['tbl_name'] # can access any of the elements this way
        

        By default tbl load from a pyui file has a ListDataSource already attached correctly as the data_source. Of course you can change it. But it's work having a good look at the ui.ListDataSource before doing so as it's quite powerful and can save you some work as well you can extend it if you need to.

        One thing to keep in mind. The code above works if your table is on the root/parent view in the builder. If you for example placed a CustomView then added the TableView to the CustomClass (so TableView is now a Subview of the CustomView) so then you would refer to your TableView like -

        tbl = v['custom_class_name']['tbl_name']
        

        I hope that last part is clear

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors