liuyg
2021-07-02 25ce610f6ecca7325e7a743dc032c4a76559c63d
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
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Test sorting of sparsely-populated fields</title>
        <meta name="viewport" content="width=570">
        <style>
            @import "../../dojo/resources/dojo.css";
            @import "../css/dgrid.css";
            @import "../css/skins/claro.css";
            body {
                padding: 0 80px; /* side padding to make it easier to scroll doc */
            }
        </style>
        <script src="../../dojo/dojo.js"
            data-dojo-config="async: true"></script>
        <script>
            require(["dgrid/Grid", "dgrid/OnDemandGrid", "dojo/_base/lang", "dgrid/test/data/createSyncStore", "dojo/domReady!"],
            function(Grid, OnDemandGrid, lang, createSyncStore){
                var data = [
                    {order: 1, name:"preheat"},
                    {order: 2, name:"mix dry", description:"In a medium bowl, combine flour, salt, and baking soda"},
                    {order: 3, name:"mix butter", description:"In a large bowl, beat butter, then add the brown sugar and white sugar then mix"},
                    {order: 4, name:"mix butter #2", description:"In a large bowl, beat butter, then add the brown sugar and white sugar then mix"},
                    {order: 5, name:"mix together", description:"Slowly add the dry ingredients from the medium bowl to the wet ingredients in the large bowl, mixing until the dry ingredients are totally combined"},
                    {order: 6, name:"chocolate chips"},
                    {order: 7, name:"make balls", description:"Scoop up a golf ball size amount of dough with a spoon and drop in onto a cookie sheet"},
                    {order: 8, name:"bake"},
                    {order: 9, name:"remove", description:"Using a spatula, lift cookies off onto wax paper or a cooling rack"},
                    {order: 10, name:"eat"}
                ];
 
                var store = createSyncStore({data: data});
 
                var columns = {
                    name: "Name",
                    description: "Description",
                    idontexist: "Empty Column"
                };
 
                window.gridArray = new Grid({
                    columns: lang.clone(columns)
                }, "gridArray");
                gridArray.renderArray(lang.clone(data));
 
                window.gridStore = new OnDemandGrid({
                    columns: lang.clone(columns),
                    collection: store
                }, "gridStore");
            });
 
        </script>
    </head>
    <body class="claro">
        <p>This page allows testing sorting of columns that are sparsely populated or
            completely unpopulated.</p>
        <h2>Grid from array</h2>
        <div id="gridArray"></div>
        <h2>Grid from store</h2>
        <div id="gridStore"></div>
    </body>
</html>