select2 v4.0.0+ with Ajax source cannot set initial value

select2 v4.0.0+ with Ajax source cannot set initial value

Lucho_1312Lucho_1312 Posts: 30Questions: 9Answers: 0

Hi!
I'm trying to use select2 in a datatable, next to the select2 plugin. The problem that I'm having is that when the datatable is initialized, the select2 field shows the data "id" instead of the associated text.
I know that that's because it's an ajax request what's in charge of getting the values for the option's id, but I'd like to know if there's a way to do this.

Thanks!
Luciano

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Are you able to give me a link to the page please? What is the JSON data you are using to populate the select2 field? What options are you using to setup the select2 field?

    Allan

This discussion has been closed.