summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/usageguide/browser/templates/dropdown.html
blob: cb974775bbc46a5e15ca0bfb950cbd0680f8106e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!--

    Copyright 2016-2017, Huawei Technologies Co., Ltd.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->


<div class="container col-sm-12 col-md-12 col-lg-12">
    <h4>Drop Down</h4>

    <div id="dropdown" class="container col-sm-12 col-md-12 col-lg-12" ng-init="init()">
        <h3>Simple Dropdown</h3>
        <div id="plainDropDown"></div>
        <h3>Dropdown</h3>
        <div id="dropArea" type="button"></div>
        <h3>Dropup</h3>
        <div id="dropAreaUP" type="button"></div>
        <h3>Dropdown Header</h3>
        <div id="dropAreaHeader" type="button"></div>

    </div>
    <div class="col-sm-12 col-md-12 col-lg-12 shortnote">
        <div class="shortnoteHeader">Usage</div>
        <div class="shortnoteText">Create a div tag  in html file with specific id  for example plainDropDown,dropArea,dropAreaUP,dropAreaHeader and write a specific function in javascript file to perform your business logic. An sample example as shown below:</div>
        <br>
        <div>HTML file:</div>
        <pre><code>&ltdiv id="dropdown" ng-init="init()"&gt&lt/div&gt</code></pre>
        <pre><code>&ltdiv id="plainDropDown" &gt&lt/div&gt</code></pre>
        <pre><code>&ltdiv id="dropArea" &gt&lt/div&gt</code></pre>
        <pre><code>&ltdiv id="dropAreaUP" &gt&lt/div&gt</code></pre>
        <pre><code>&ltdiv id="dropAreaHeader" &gt&lt/div&gt</code></pre>


        <br>
        <div>Javascript file:</div>
        <pre><code>
        var data ={"dropped_down_data" :{"title":"DropDown","position":"down", "items":[{"itemLabel": "Node JS"},{"itemLabel": "JS"}]},"dropped_up_data" :{"title":"DropUp","position":"up", "items":[{"itemLabel": "PHP"},{"itemLabel": "ASP"}]},"dropHeader_data" :{"title":"DropHeader","position":"down","items":[{"itemLabel": "Web UI", "isheader":true},{"itemLabel": "HTML", "isheader":false},{"itemLabel": "CSS", "isheader":false},{"itemLabel": "JS", "isheader":false},{"itemLabel": "Programming", "isheader":true},{"itemLabel": "C", "isheader":false},{"itemLabel": "C++", "isheader":false}]},"dropSimple_data" : {"title":"--PleaseSelect--","items":[{"itemLabel": "Cameras"},{"itemLabel": "Mobile Phones"},{"itemLabel": "Computers"},{"itemLabel": "Monitors"},{"itemLabel": "Tablets"},{"itemLabel": "Others"}]}};

        $scope.init = function() {
               loadDrop();
        }

         function loadDrop() {
            var drop_tpl = $(modelTemplate).filter('#dropDown').html();
            var dropHeader_tpl = $(modelTemplate).filter('#dropDownHeader').html();
            var dropSimple_tpl = $(modelTemplate).filter('#simpleDropdownTmpl').html();

            var html = Mustache.to_html(drop_tpl, data.dropped_down_data);
            $('#dropArea').html(html);

            var html = Mustache.to_html(drop_tpl, data.dropped_up_data);
            $('#dropAreaUP').html(html);

            var html = Mustache.to_html(dropHeader_tpl, data.dropHeader_data);
            $('#dropAreaHeader').html(html);

            var html = Mustache.to_html(dropSimple_tpl, data.dropSimple_data);
            $('#plainDropDown').html(html);

        }</code></pre>




        </div>
    </div>
</div>