nnnjjj123
2020-11-17 1b2c1edb61190eeb19f465ff031eaa3b2a1b8dbc
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Test Declarative Dijit Layout</title>
        <meta name="viewport" content="width=570">
        <style>
            @import "../../dijit/themes/claro/document.css";
            @import "../css/dgrid.css";
            @import "../../dijit/themes/claro/claro.css";
            @import "../css/skins/claro.css";
            html, body {
                padding: 0;
                width: 100%;
                height: 100%;
            }
            #bc {
                width: 99%;
                height: 99%;
            }
            .bcLeft {
                width: 300px;
            }
            .dijitDialog {
                width: 500px;
            }
        </style>
        <script src="../../dojo/dojo.js"
            data-dojo-config="async: true"></script>
        <script>
            // callbacks for button clicks
            function showDeclDialog(){ dlgDecl.show(); }
 
            // function to get a unique set of column definitions for each grid
            function getGridCols(){
                return {
                    col1: 'Column 1',
                    col2: {name: 'Column 2', sortable: false},
                    col3: 'Column 3',
                    col4: 'Column 4'
                };
            }
 
            require(["dojo/parser",
                "dgrid/test/data/testStore",
                // widgets only used declaratively
                "dijit/Dialog",
                "dijit/layout/BorderContainer",
                "dijit/layout/TabContainer",
                "dijit/Toolbar",
                "dijit/form/Button",
                "dgrid/OnDemandGrid",
                "dgrid/extensions/DijitRegistry",
                // non-returns
                "dojo/domReady!"
            ], function(parser, testStore){
                window.testStore = testStore;
                parser.parse();
            });
        </script>
    </head>
    <body class="claro">
        <div data-dojo-type="dijit/layout/BorderContainer" id="bc">
            <div data-dojo-type="dijit/Toolbar" class="bcTop"
                data-dojo-props="id:'tbTop', region:'top'">
                <span data-dojo-type="dijit/form/Button"
                    data-dojo-props="onClick: showDeclDialog">
                    Show declarative dialog
                </span>
            </div>
            <!-- left: dgrid as direct child -->
            <div id="gridBCCP" class="bcLeft"
                data-dojo-type="dgrid/OnDemandGrid"
                data-dojo-mixins="dgrid/extensions/DijitRegistry"
                data-dojo-props="region: 'left', splitter: true, collection: testStore, columns: getGridCols()">
            </div>
            <!-- center: tabcontainer -->
            <div data-dojo-type="dijit/layout/TabContainer" class="bcCenter" id="tc"
                data-dojo-props="region: 'center'">
                <!-- initial tab: dgrid as direct child -->
                <div id="gridTab1" class="gridTab"
                    data-dojo-type="dgrid/OnDemandGrid"
                    data-dojo-mixins="dgrid/extensions/DijitRegistry"
                    data-dojo-props="title: 'Tab 1', collection: testStore, columns: getGridCols()">
                </div>
                <!-- tab 2: dgrid as direct child again, but not initially visible -->
                <div id="gridTab2" class="gridTab"
                    data-dojo-type="dgrid/OnDemandGrid"
                    data-dojo-mixins="dgrid/extensions/DijitRegistry"
                    data-dojo-props="title: 'Tab 2', collection: testStore, columns: getGridCols()">
                </div>
            </div>
        </div>
        <!-- declarative dialog w/ dgrid inside -->
        <div data-dojo-type="dijit/Dialog" id="dlgDecl" data-dojo-id="dlgDecl">
            <div id="gridDlgDecl"
                data-dojo-type="dgrid/OnDemandGrid"
                data-dojo-mixins="dgrid/extensions/DijitRegistry"
                data-dojo-props="collection: testStore, columns: getGridCols()"></div>
        </div>
    </body>
</html>