Hi,
I have a form that contains a data grid, among other things. To select the items I want to assign, I open another form:
@handle("link_add_hardware", "click")
def link_add_hardware_click(self, **event_args):
list_hardware = []
editing_form = Select_Hardware("", "")
list_hardware = alert(content=editing_form, title="Select Hardware", large=True, buttons=[])
if len(list_hardware) > 0:
anvil.server.call('add_hardware_to_processing_activity', self.uid, list_hardware)
In the form is a datagrid with the items. The first column contains a checkbox to select items:
@handle("checkbox_select", "change")
def checkbox_select_change(self, **event_args):
if self.checkbox_select.checked:
self.parent.raise_event('x-add-hardware', hardware=self.item)
else:
self.parent.raise_event('x-remove-hardware', hardware=self.item)
The code to add the selected item to the list of selected items:
def __init__(...)
self.repeating_panel_1.add_event_handler('x-add-hardware', self.add_hardware)
...
def add_hardware(self, hardware, **event_args):
self.list_hardware.append(hardware)
Then i click on Ok:
@handle("button_ok", "click")
def button_ok_click(self, **event_args):
self.raise_event('x-close-alert', value=self.list_hardware)
The code to add the items in the servermodule:
@anvil.server.callable
def add_hardware_to_processing_activity(uid, items_hardware):
pa = app_tables.dp_processing_activities.get(uid=uid)
print("PA: " + pa['name'])
if pa['hardware'] is not None:
pa['hardware'] += [items_hardware]
else:
pa['hardware'] = [items_hardware]
The error message is:
anvil.server.InternalError: Internal server error: 454f056ce1e5
at /home/anvil/downlink/anvil/_threaded_server.py:518
called from /home/anvil/downlink/anvil/_server.py:46
called from /home/anvil/downlink/anvil/_server.py:86
called from ServerModule1, line 156
called from /home/anvil/downlink/anvil/_threaded_server.py:191
called from DataProtection.Edit_Processing_Activity, line 59
I hope it is understandable. If you need further information please tell me.