Extra parameter templateSelection
See original GitHub issueHello i have this problem latest version of select 2
I inizialize select 2 with extra parameter:
let data = {
id: this.caratteristica.CaratteristicaInfo.Id,
text: this.caratteristica.CaratteristicaInfo.Nome,
acronimo: this.caratteristica.CaratteristicaInfo.Acronimo,
qualita: this.caratteristica.CaratteristicaInfo.Qualita
};
var caratteristicaSelect = (<any>$(this.render.nativeElement));
var option = new Option(this.caratteristica.CaratteristicaInfo.Nome, this.caratteristica.CaratteristicaInfo.Id, true, true);
caratteristicaSelect.append(option).trigger('change');
caratteristicaSelect.trigger({
type: 'select2:select',
params: {
data: data
}
});
but i don’t find this parameter on templateSelection so i can’t unable to render well data inside how do i ajax request.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Select2 parameter for templateResult and templateSelection ...
Ok I have an answer. In the context of initProductSelect2() i create an options object that is populated in ProcessResults and then i ......
Read more >templateSelection is not receiving the same JSON data ...
Then, templateSelection receives as 'data' parameter an standard JSON:{ ... and assuming there's “extra” data in the inserted item that you ...
Read more >Passing extra data to select2 - Laracasts
I've got a multiple select box working well for 'colour' with select2 but I'm wanting to add the hex code colours next to...
Read more >Conditional template selection & generation - S-Docs
The doclist can include as many S-Doc templates as you'd like. If you just append the doclist parameter, templates will be automatically ...
Read more >Select2 3.5.3
For more info on the parameters, refer to the JQuery API Documentation. ... an object that contains extra parameters that will be passed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1
I’ve lost some time on this too (mostly creating a jsfiddle to demonstrate this)
I don’t have time to look over the source code to try to find a proper solution (and maybe propose a PR) but I’ve just crafted a custom / dirty hack on this, maybe somebody else will find this handy, it might be too late for @Toso82 after almost a year though
data
attribute on it (the option). You can choose yourself what data you need in the template and how to pass it: multipledata
attributes or only one as JSON string with all data like I didI think it is not a good solution