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.
Difference between section and row TableView
-
I'm trying to understand the difference between a section and a row in a TableView. When a create a datasource with e.g. 3 items and query the tableview_number_of_sections the answer is three. When I query the tableview_number_of_rows, then the answer is one, so one row in each section. My expectation however was: one section, 3 rows. So, can someone explain the difference between section and row and how they can be used within a TableView?
Thanks,
Peter
-
Sections are groups of rows, so for example in a file list you could have the sections "folders", "documents", "images", "sound", "videos". If you want a list without section headers, make
tableview_number_of_sections
return 1.I'm not sure what you mean by "when I create a datasource" - are you using
ui.ListDataSource
or are you writing your own data source class? As far as I knowListDataSource
doesn't support sections. If you're creating a custom data source, make sure that you inherit fromobject
and that you implement all methods listed in the documentation. -
OK, thanks, this makes things more clear to me. Yes, I've created a custom data source with the necessary methods, however
tableview_number_of_sections
does not return 1 and that's what I need.