Test Setup Failed
Push — master ( aec174...6c550f )
by Александр
36:31
created

sx.classes.Component.extend._init   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
/*!
2
 * @author Semenov Alexander <[email protected]>
3
 * @link http://skeeks.com/
4
 * @copyright 2010 SkeekS (СкикС)
5
 * @date 24.03.2018
6
 */
7
(function (sx, $, _) {
0 ignored issues
show
Unused Code introduced by
The parameter _ is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
8
    sx.createNamespace('classes', sx);
9
10
    sx.classes.DualSelect = sx.classes.Component.extend({
11
12
        _init: function () {
13
14
        },
15
16
        _onDomReady: function () {
17
            var self = this;
18
19
            this.jWrapper = $("#" + this.get('id'));
20
21
            this.jHidden = $(".sx-sortable-hidden", this.jWrapper);
22
            this.jVisible = $(".sx-sortable-visible", this.jWrapper);
23
24
            this.jElement = $(".sx-select-element", this.jWrapper);
25
26
            this.jHidden.sortable({
27
                //items: "li:not(.ui-state-disabled)"
28
                connectWith: "." + this.get('id') + "-conncected",
29
                dropOnEmpty: false,
30
                out: function() {
31
                    self._update();
32
                }
33
            });
34
35
            this.jVisible.sortable({
36
                /*cancel: ".ui-state-disabled",*/
37
                connectWith: "." + this.get('id') + "-conncected",
38
                dropOnEmpty: false,
39
                out: function() {
40
                    self._update();
41
                }
42
            });
43
        },
44
45
        _update: function () {
46
            var self = this;
47
48
            this.jElement.empty();
49
50
            $('li', this.jVisible).each(function() {
51
                self.jElement.append(
52
                    $('<option>', {
53
                        'selected' : 'selected',
54
                        'value' : $(this).data('value')
55
                    }).append($(this).text())
56
                )
57
            });
58
59
            this.trigger('change');
60
            this.jElement.change();
61
        }
62
    });
63
})(sx, sx.$, sx._);
0 ignored issues
show
Bug introduced by
The variable sx seems to be never declared. If this is a global, consider adding a /** global: sx */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...