teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

コードの修正

2018/02/03 04:19

投稿

gottadiveintopy
gottadiveintopy

スコア736

answer CHANGED
@@ -37,11 +37,9 @@
37
37
  ]
38
38
 
39
39
  def delete(self):
40
- print('DELETE')
40
+ # print('DELETE')
41
- self.rv.data = [
41
+ self.rv.data = list(filter(
42
- item for item in filter(
43
- lambda item: not item['is_checked'],
42
+ lambda item: not item['is_checked'], self.rv.data))
44
- self.rv.data)]
45
43
 
46
44
 
47
45
  class Row(BoxLayout):

1

コードの修正

2018/02/03 04:19

投稿

gottadiveintopy
gottadiveintopy

スコア736

answer CHANGED
@@ -52,8 +52,7 @@
52
52
  def on_checkbox_press(self, checkbox):
53
53
  # print('on_checkbox_press', checkbox.state, checkbox.active)
54
54
  rv = SM.get_screen('manager').rv
55
- data = rv.data
55
+ for item in rv.data:
56
- for index, item in enumerate(data):
57
56
  if item['id'] == self.id:
58
57
  # print('Found', item)
59
58
  item['is_checked'] = checkbox.active