Bug Fix: ajax.url is a function in editor.select2.js
Bug Fix: ajax.url is a function in editor.select2.js
Vitaliy V. Tokarev
Posts: 3Questions: 0Answers: 0
in Plug-ins
Hello,
I have attached a patch for editor.select2.js plugin. The patch resolves issue if ajax.url parameter is a function.
In detail, beforeSend() callback is called like settings.url is a string. This is a cause of the problem.
An example of the case is below:
var editor = new $.fn.dataTable.Editor({
fields: [
{
name: 'Field.Id',
label: "MyLabel",
editField: 'Field.Id',
type: 'select2',
optionsPair: { label: 'Name', value: 'Id' },
opts: {
ajax: $.extend(true, {}, select2AjaxBase, {
url: function () {
var url = '/api/v2/Entities',
paramid= $('select#DTE_Field_Param-Id').val();
if (paramid)
url = url + '?paramid=' + paramid;
return url;
}
}),
},
},
]});
Setup:
* jQuery v3.3.1
* jQuery UI 1.12.1
* DataTables v1.10.18
This discussion has been closed.
Replies
Thank you for this!
Allan