Login Register

Dojo 1.1 BorderContainer and ItemFileReadStore don't work together, bug?

Hi,

I am using test_grid_layout_borderContainer.html under dojox/grid/tests as starting point. test_grid_layout_borderContainer.html works fine without any modifications. However, if I changed the data store with ItemFileReadStore, there is no data showing up but a red background color. Is this a bug or I am missing something?

Code as below:

<head>
                <title>Test dojox.Grid Editing</title>
                <style>
                        @import "../_grid/tundraGrid.css";
                        @import "../../../dojo/resources/dojo.css";
                        @import "../../../dijit/themes/tundra/tundra.css";
                        @import "../../../dijit/tests/css/dijitTests.css";

                        html, body {
                                width: 100%;    /* make the body expand to fill the visible window */
                                height: 100%;
                                overflow: hidden;       /* erase window level scrollbars */
                                padding: 0 0 0 0;
                                margin: 0 0 0 0;
                        }
                </style>
                <script type="text/javascript" src="../../../dojo/dojo.js"
                        djConfig="isDebug:false, parseOnLoad: true">
</script>

                <script type="text/javascript">
                        dojo.require("dojox.grid.Grid");
                        dojo.require("dijit.layout.BorderContainer");
                        dojo.require("dijit.layout.ContentPane");
                        dojo.require("dojo.parser");
                </script>

                <script type="text/javascript">
                        gridLayout = [
                                {
                                        type: 'dojox.GridRowView', width: '20px'
                                },
                                {
                                        defaultCell: { width: 8, editor: dojox.grid.editors.Input, styles: 'text-align: right;'  },
                                        rows: [
                                                [
                                                        { name: 'Id', width: 3, get: function(inRowIndex){ return inRowIndex+1;} },
                                                        { name: 'Priority', field:'priority',styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: ["normal", "note", "important"]},
                                                        { name: 'Mark', field:'mark',width: 3, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },
                                                        { name: 'Status', field: 'status', styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: [ "new", "read", "replied" ]},
                                                        { name: 'Message', field:'message',styles: '', width: '100%' },
                                                        { name: 'Amount',field:'amount'}
                                                ]
                                        ]
                                }
                        ];

                       
                </script>
        </head>
        <body class="tundra">
<div dojoType="dijit.layout.BorderContainer"  liveSplitters="false" persist="true"
          id="verticalSplitParam" design="headline" style="width: 100%; height: 100%;">


  <div dojoType="dijit.layout.ContentPane" id="mybuttons" region="top"
            splitter="true"  style="width: 100%; height: 10%;">
 

            <div id="controls">
                     <button onclick="grid.refresh()">Refresh</button>
                     <button onclick="grid.edit.focusEditor()">Focus Editor</button>
                     <button onclick="grid.focus.next()">Next Focus</button>
                     <button onclick="addRow()">Add Row</button>
                     <button onclick="grid.removeSelectedRows()">Remove</button>
                     <button onclick="grid.edit.apply()">Apply</button>
                     <button onclick="grid.edit.cancel()">Cancel</button>
                     <button onclick="grid.singleClickEdit = !grid.singleClickEdit">Toggle singleClickEdit</button>
            </div>
  </div>

  <div dojoType="dijit.layout.ContentPane" id="gridContainer1" region="center" splitter="true" style="background: red;" >
            <span dojoType="dojo.data.ItemFileReadStore"
                jsId="jsonStore" url="test.json">

        </span>
        <span dojoType="dojox.grid.data.DojoData"
                jsId="dataModel2"
                rowsPerPage="20"
                store="jsonStore"
                query="{ priority : '*' }">

        </span>
            <div jsId="grid" class="myGrid"         dojoType="dojox.Grid" model="model"         structure="gridLayout"></div>
  </div>

</div>

</body>

test.json is:

{ identifier: 'amount',
label: 'amount',
items: [
{ priority:'normal', mark:'false', status:'new', message: 'But are not followed by two hexadecimal',amount: '29.91'},
{ priority:'important', mark:'false', status:'new', message: 'Because a % sign always indicates',amount: '9.33'},
{ priority:'important', mark:'false', status:'read', message: 'Signs can be selectively',amount: '19.34'},
{ priority:'note', mark:'false', status:'read', message: 'However the reserved characters',amount: '15.63},
{ priority:'normal', mark:'false', status:'replied', message: 'It is therefore necessary',amount: '24.22'},
{ priority:'important', mark:'false', status:'replied', message: 'To problems of corruption by',amount: '9.12'},
{ priority:'note', mark:'false', status:'replied', message: 'Which would simply be awkward in',amount: '12.15'}
]}

One mistake correction

Please change the code from:

<div jsId="grid" class="myGrid"  dojoType="dojox.Grid" model="model" structure="gridLayout"></div>

to:

<div jsId="grid" class="myGrid" dojoType="dojox.Grid" model="dataModel2" structure="gridLayout"></div>