Django-select2 how to use three tables?

0 like 0 dislike
10 views
There is a form of adding features, it is necessary to make two dependent fields Feature and Value list in the Value field should change depending on the selected Features, how to implement it using django-select2 and the table structure is attached below
5ac4ab0cc7831870568956.png5ac4ab00ac4e2309005809.png
by | 10 views

1 Answer

0 like 0 dislike
When you change the value in the field of CHARACTERISTICA send an ajax request on the selection of valid values and the response to fill up in value

$.ajax({ method: 'post', data: data, type: 'json', success: function (responce) { var data = [{id: ", text: helpText, disabled: true, selected: true}]; if (responce.data) { responce.data.map(function (el) { data.push(el); }); $('#VALUE').select2('destroy').empty().select2({data: data}); } }, error: function (e) { console.log(e); } });
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,644 users