Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
var FormSamples = function () {
2
 
3
 
4
    return {
5
        //main function to initiate the module
6
        init: function () {
7
 
8
            // use select2 dropdown instead of chosen as select2 works fine with bootstrap on responsive layouts.
9
            $('.select2_category').select2({
10
                    placeholder: "Select an option",
11
                    allowClear: true
12
                });
13
 
14
            $('.select2_sample1').select2({
15
                placeholder: "Select a State",
16
                allowClear: true
17
            });
18
 
19
            $(".select2_sample2").select2({
20
                placeholder: "Type to select an option",
21
                allowClear: true,
22
                minimumInputLength: 1,
23
                query: function (query) {
24
                    var data = {
25
                        results: []
26
                    }, i, j, s;
27
                    for (i = 1; i < 5; i++) {
28
                        s = "";
29
                        for (j = 0; j < i; j++) {
30
                            s = s + query.term;
31
                        }
32
                        data.results.push({
33
                            id: query.term + i,
34
                            text: s
35
                        });
36
                    }
37
                    query.callback(data);
38
                }
39
            });
40
 
41
            $(".select2_sample3").select2({
42
                tags: ["red", "green", "blue", "yellow", "pink"]
43
            });
44
 
45
        }
46
 
47
    };
48
 
49
}();