I’m trying to set a datatable cell to be a combo box which get’s populated from server-side.
On page load the the combo box should display the current value and the user should be able to modify the value by selecting another value from the combo box. Please find a simplified version of the code here: https://snippet.webix.com/pjbsl4i6
The api api_tc_supplier
returns a json representation of a database table with the columns id, supplier, supplier_code and a few more.
I’m using webix in combination with Django.
I defined the function data
as follows:
def data(request):
# get all data
if request.method == 'GET':
silis = db_models.TcSili.objects.all();
data = [{
'supplier': sili.tc_supplier.supplier,
'line_item': sili.line_item,
'cost': sili.cost, 'vat': sili.vat,
'start_date': sili.start_date,
'end_date': sili.end_date,
'payment_period_months': sili.payment_period_months,
'ruleset_name': sili.tc_ruleset.name,
'is_one_off_cost_yn': sili.is_one_off_cost_yn,
'is_deleted_yn': sili.is_deleted_yn
} for sili in silis]
return JsonResponse(data, safe=False)
This functions get’s called by table1
in the above example.
The current version populates the combo box correctly on page load and displays the available options on expansion of the box. But after selecting an entry the datatable cell shows the id rather than the chosen value.
Could someone advice on the common way of loading combo box options from the server and how one would save the changes?
Many thanks!