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.


    Using delete in ui.Tableview

    Pythonista
    ui module delete tableview
    3
    3
    3670
    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.
    • jymm
      jymm last edited by

      I have done a few searches on this site, and others and have been unsuccessful at finding the right way to approach this. At the very least I was unable to extract how to make this specific task work.

      In the ui module when you have an object in the Tableview you can swipe left and it gives you the Delete option. When you click on it, it removes the row. How do I modify that action to take additional actions? I.e. I want to add a confirm dialog, probably with console.alert() and then not only remove the item but send pcommands to delete the file associated with it?

      I currently don't have code that represents this task well, but if any of my other code in generating the Tableview data would be helpful please let me know and I will be happy to post. I am not using any delegates at the moment, since I am having trouble getting them to work, which might be part of my problem. I should also note that I am using the GUI creation tool for building the interface.

      And suggestions would be appreciated. Thanks!

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by ccc

        if any of my other code in generating the Tableview data would be helpful

        Posting your existing code is always helps.

        import os
        import ui
        
        ui.TableView(__name__, data_source=ui.ListDataSource(items=os.listdir())).present()
        

        See the ui- tutorial https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/UI.md
        andfilenav https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/Utilities.md

        1 Reply Last reply Reply Quote 0
        • ramvee
          ramvee last edited by

          I found this example useful. Hope it helps.

          https://forum.omz-software.com/topic/1524/simple-demo-of-tableview-logic-for-the-novices

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