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.
Ui Tableview problem
-
Hi,
I just don't seem to be able to have an alert dialog prompt for the selected row in my table view.
dialogs.alert('test', sender.items[sender.selected_row], 'Ok',hide_cancel_button=True)
After I compute my data from my list and click a row. nothing pop in the alert dialog.
Thank you for your kind help.
here's images of my ui:
https://imgur.com/IyHPN5z
https://imgur.com/6tbWecqhere's my code:
import ui import people_also_ask import people_also_ask.request.session import clipboard import time import requests import dialogs from objc_util import nsurl,UIApplication def compute(sender): data = v['textfield1'].text.split(",") datasource = ui.ListDataSource(data) v['tableview1'].data_source=datasource v['tableview1'].reload_data() @ui.in_background def pressed(sender): dialogs.alert('test', sender.items[sender.selected_row], 'Ok',hide_cancel_button=True) v = ui.load_view() v.present('sheet')
-
@daxo try
def compute(sender): data = v['textfield1'].text.split(",") v['tableview1'].data_source.items = data v['tableview1'].reload_data()
Do not recreate a datasource each time, only reload its items
-
wow @cvp, thank you for your solution!
I clearly understands my mistake now.