Hello,
Regarding the below code, please help me with:
- how I will add data from json in datagrid (for each column separately) and editing after
- how I will set lost focus (for future data validation) in somes textboxes.
class Form1(Form1Template):
def init(self, **properties):
Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
grid = DataGrid()
self.add_component(grid)
grid.columns = [
{ "id": "A", "title": "Cont", "data_key": "column_1",'width': '90' },
{ "id": "B", "title": "Denumire", "data_key": "column_2",'width': '150'},
{ "id": "C", "title": "Cod", "data_key": "column_3",'width': '40'},
{ "id": "D", "title": "Debit", "data_key": "column_4",'width': '100' },
{ "id": "E", "title": "Credit", "data_key": "column_5",'width': '100' },
{ "id": "F", "title": "Debit", "data_key": "column_6",'width': '100' },
{ "id": "G", "title": "Credit", "data_key": "column_7",'width': '100' },
{ "id": "H", "title": "Debit", "data_key": "column_8",'width': '100' },
{ "id": "I", "title": "Credit", "data_key": "column_9",'width': '100' }
]
self.text_box = []
row = DataRowPanel()
for i in range(1,10):
for col in grid.columns:
k=1
txb = self.add_tb(k)
row.add_component(txb, column=col["id"])
txb.set_event_handler("...lost focus", self.ver())??? -
k=k+1
grid.add_component(row)
grid.show_page_controls = True
grid.rows_per_page = 20
grid.role = "wide"
def add_tb(self,k):
tb = TextBox( font=âArialâ )
tb.role = âinputâ
tb.tag.name = k
return tb
pass
def ver(self):
print(âbâ)
pass