datamade/just-spaces

CensusArea select widget won't display options when adding a new chart

Closed this issue · 0 comments

Something about the way we initialize Select2 for CensusArea widgets in the DAD is preventing them from showing options. If you remove this line, the input will show the right options, albeit without Select2 enabled:

$('.basic-multiple').select2();

One possible story is that, with the line in intact, Select2 will initialize the input UI in the context of the hidden form template (where it has no options) before the chart actually gets displayed. Then when we copy the hidden form template HTML to create a new chart form, it has no options:

$('#add-new-chart').click(function() {
var formIdx = $totalForms.val();
$('#sortable-chart-container').append($('#chart-formset-template').html().replace(/__prefix__/g, formIdx));