Total Complexity | 7 |
Complexity/F | 1.17 |
Lines of Code | 36 |
Function Count | 6 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | function deleteRole(role) { |
||
2 | console.log(getFuncName(), role); |
||
|
|||
3 | } |
||
4 | AjaxForm(); |
||
5 | |||
6 | jQuery(document).ready(function () { |
||
7 | load_module(["select2"], function () { |
||
8 | var dataSource = []; |
||
9 | /** |
||
10 | * @type {string[]} |
||
11 | */ |
||
12 | var dataIntangible = selectOptions; |
||
13 | dataIntangible.forEach(function (data, index) { |
||
14 | dataSource.push({ text: data, id: data }); |
||
15 | }); |
||
16 | //console.log(dataSource); |
||
17 | jQuery('[id^="select-"]').each(function (index, value) { |
||
18 | jQuery(this).select2({ |
||
19 | data: dataSource, |
||
20 | theme: "material", |
||
21 | placeholder: "Select a route", |
||
22 | allowClear: true, |
||
23 | templateSelection: function (data) { |
||
24 | if (data.id === "") { |
||
25 | // adjust for custom placeholder values |
||
26 | return "Custom styled placeholder text"; |
||
27 | } |
||
28 | |||
29 | return data.text; |
||
30 | }, |
||
31 | }); |
||
32 | var val = jQuery(this).data("key"); |
||
33 | console.log(val); |
||
34 | }); |
||
35 | }); |
||
36 | }); |
||
37 |