Forum Archive

reordering a TableView in pythonista

polymerchm

Is this doable? I understand (I think) how its accomplished in native iOS, but ot sure if @OMZ has exposed enough.

polymerchm

Answering my own question:

the pyui file is just a single tableview whose name is tableview1

# coding: utf-8

import ui

lds = ui.ListDataSource(items="this is a test".split())


v = ui.load_view()

v['tableview1'].delegate = v['tableview1'].data_source = lds
lds.move_enabled = True
v['tableview1'].editing = True
v.present('sheet')

the order of the list in lds.items is in sync with what is displayed. All sorts of possibiities. Cool!