What I’m trying to do:
create data grid during run time
What I’ve tried and what’s not working:
self.data_grid_1.columns=[
{ ‘id’: ‘2’, ‘title’: ‘Exp Descr’, ‘data_key’: ‘exp_descr’ },
{ ‘id’: ‘3’, ‘title’: ‘Exp Type’, ‘data_key’: ‘exp_type’ },
{ ‘id’: ‘4’, ‘title’: ‘Exp Amt’, ‘data_key’: ‘exp_amount’ },
{ ‘id’: ‘6’, ‘title’: ‘Exp Date’, ‘data_key’: ‘exp_dt’ }
]
self.data_grid_1.columns=self.data_grid_1.columns
after setting this my data grid allignment is not working properly , whereas if i create the data grid using the editor the data format is perfect
Can you tell me what iam missing , I could see that when setting the grid using editor the ID Key has a 6 digit key something like this
Editor Grid
[{‘id’: ‘HSIEHR’, ‘title’: ‘Exp Desc’, ‘data_key’: ‘exp_descr’},
{‘id’: ‘EDSYAX’, ‘title’: ‘Exp Type’, ‘data_key’: ‘exp_type’},
{‘id’: ‘BPQFCP’, ‘title’: ‘Exp Amt’, ‘data_key’: ‘exp_amount’},
{‘id’: ‘CUHYLK’, ‘title’: ‘Exp Date’, ‘data_key’: ‘exp_dt’}]
Run time Grid
[{'id': '2', 'title': 'Exp Descr', 'data_key': 'exp_descr'},
{'id': '3', 'title': 'Exp Type', 'data_key': 'exp_type'},
{'id': '4', 'title': 'Exp Amt', 'data_key': 'exp_amount'},
{'id': '6', 'title': 'Exp Date', 'data_key': 'exp_dt'}]
Code Sample:
# code snippet
Clone link:
share a copy of your app