What I’m trying to do:
I have a form where I created a data grid and one of the columns is a button that should lead to another form to show additional details of the row. I need to pass the value of the ‘action’ which would be an int.
What I’ve tried and what’s not working:
I’ve added the following code on the button
def button_1_click(self, **event_args):
"""This method is called when the button is clicked"""
open_form('Warehouse.PickingSlip', sales_order=self.item['sales_order_no'])
Code Sample:
from ._anvil_designer import ReadyToDeliverTemplate
from anvil import *
import anvil.server
import anvil.users
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
class ReadyToDeliver(ReadyToDeliverTemplate):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
sales_orders_data = anvil.server.call("sales_orders_ready_to_deliver")
sales_orders = []
for order in sales_orders_data:
sales_info = {
'sales_order_no': order['id'],
'company_name': order['company']['identifier'],
'action': order['id']
}
sales_orders.append(sales_info)
# Any code you write here will run before the form opens.
self.repeating_panel_1.items = sales_orders
Clone link:
share a copy of your app