editor plug-ins select2 - separator and onFocus options not working
editor plug-ins select2 - separator and onFocus options not working
Hi, the demo can be viewed at
https://nfctech.eu/datatables/editor-select2-bootstrap.html
and the used code is
{
"label": "AREA*:",
"name": "area",
"type": "select2",
"options": [
"Francia",
"Nord Italia",
"Russia",
"Americhe"
],
"opts": {
"multiple": true,
"placeholder": "Seleziona un'area di competenza",
"allowClear": true,
"minimumResultsForSearch": "Infinity",
"theme": "bootstrap"
},
"onFocus": "open",
"separator": ", "
}
The problems are:
1. When tabbing and the select2 get focus it does not open despite the onFocus option
2. Even if the separator option includes a white space, the final result in datatables is that the chosen options are only separated by the comma and the white space is ignored
Any suggestions?
Thanks
This discussion has been closed.
Replies
1) This is an interesting one. If you use a synthetic focus event I believe it will work:
editor.field('nazione').focus();
. But using a manual focus (keyboard or mouse), theonFocus
handler in Editor doesn't actually trigger.For the moment do something like:
which I think should work around this.
2) It looks like the data is being submitted to the server with the space:
Possibly something on the server-side is stripping it out? I'm getting an error on the page when it is loading data at the moment so I can't be sure.
Regards,
Allan
Hi Allan,
concerning point 1) I solved with this code snippet taken from
https://github.com/select2/select2/issues/4025
It is valid for all the selects.
Concerning point 2), we will see if we can prepare a demo that is fully accessible to the public.
Thanks