Created
October 11, 2013 17:48
-
-
Save amalgamatedclyde/6939055 to your computer and use it in GitHub Desktop.
how do i update my listadapter data? the callback updates the ListProperty, but how do i use the ListProperty to update the adapter? maybe the ListProperty needs to a property of the adapter?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here is the class: | |
class StudentDetailList(ListView): | |
updater = ListProperty([]) | |
def __init__(self, **kwargs): | |
super(StudentDetailList, self).__init__(**kwargs) | |
here are the adapters: | |
class carouselApp(App): | |
global update | |
def __init__(self, **kwargs): | |
super(carouselApp, self).__init__(**kwargs) | |
self.myAdapter= ListAdapter(data=getRow(0), args_converter=my_args_converter, selection_mode= 'multiple', allow_empty_selection= True, | |
cls=CompositeListItem) | |
self.myAdapter124= ListAdapter(data=getRow(124), args_converter=my_args_converter, selection_mode= 'multiple', allow_empty_selection= True, | |
cls=CompositeListItem) | |
self.myAdapter130= ListAdapter(data=getRow(130), args_converter=my_args_converter, selection_mode= 'multiple', allow_empty_selection= True, | |
cls=CompositeListItem) | |
self.myAdapter145= ListAdapter(data=getRow(145), args_converter=my_args_converter, selection_mode= 'multiple', allow_empty_selection= True, | |
cls=CompositeListItem) | |
self.myAdapter224= ListAdapter(data=getRow(224), args_converter=my_args_converter, selection_mode= 'multiple', allow_empty_selection= True, | |
cls=CompositeListItem) | |
self.myAdapter330= ListAdapter(data=getRow(330), args_converter=my_args_converter, selection_mode= 'multiple', allow_empty_selection= True, | |
cls=CompositeListItem) | |
self.SDA = studentDetailsAdapter(data=[], cls= ListItemLabel) | |
self.SA= studentAdapter(data= StudentList(),allow_empty_selection= True, cls= ListItemButton ) | |
this is the listview in kv: | |
StudentDetailList: | |
id: details | |
adapter: app.SDA | |
and this is the callback: | |
def callback(instance): | |
try: | |
detailsList= StudentDetail(lastname(instance.text), firstname(instance.text)) | |
StudentDetailList.updater= (formatlist(detailsList)) | |
print 'SDA data is', StudentDetailList.updater | |
StudentPhoto.source= photoName(detailsList[6]) | |
StudentPhoto.allow_stretch= True | |
StudentPhoto.scale = 2 | |
return True | |
#medicalinfo.text= detailsList[7] | |
#emergencyContact.text= '[b]Emergency Contact: \n[/b]' + '[b]' + detailsList[3] + '[/b]' | |
except (IndexError, AttributeError): | |
StudentPhoto.source= '/home/clyde/kids/765-default-avatar.png' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment