Synchronize cell and editable content in treeview
issue9227 review289791002
This commit is contained in:
1 parent
7073e0f822
commit
fcd11b3ef0
2 files changed
+14
No files matched your search
@@ -1044,6 +1044,7 @@ class ViewTree(View):
|
||||
if not name:
|
||||
continue
|
||||
widget = self.get_column_widget(column)
|
||||
widget.set_editable(current_record)
|
||||
if decoder.decode(widget.attrs.get('tree_invisible', '0')):
|
||||
column.set_visible(False)
|
||||
elif name == self.screen.exclude_field:
|
||||
|
||||
@@ -291,6 +291,11 @@ class GenericText(Cell):
|
||||
if callback:
|
||||
callback()
|
||||
|
||||
def set_editable(self, record):
|
||||
if not record or not self.editable:
|
||||
return
|
||||
self.editable.set_text(self.get_textual_value(record))
|
||||
|
||||
def editing_started(self, cell, editable, path):
|
||||
def remove(editable):
|
||||
self.editable = None
|
||||
@@ -973,6 +978,14 @@ class Selection(GenericText, SelectionMixin, PopdownMixin):
|
||||
if callback:
|
||||
callback()
|
||||
|
||||
def set_editable(self, record):
|
||||
if not record or not self.editable:
|
||||
return
|
||||
field = record[self.attrs['name']]
|
||||
value = self.get_value(record, field)
|
||||
self.update_selection(record, field)
|
||||
self.set_popdown_value(self.editable, value)
|
||||
|
||||
def editing_started(self, cell, editable, path):
|
||||
super(Selection, self).editing_started(cell, editable, path)
|
||||
record, field = self._get_record_field_from_path(path)
|
||||
|
||||
Reference in new issue
Block a user