dojo datagrid首次加载问题

时间:2014-12-23 11:48:31

标签: datagrid dojo

大家好我在TabContainer / BorderContainer / ContentPane中有一个dojo数据网格

数据网格以程序方式呈现,代码为:

<script>
require(['dojo/request',
         'dojo/dom', 
         'dijit/Dialog',
         'dojo/date/locale',
         'dojo/_base/array',
         'dojo/store/Memory',
         'dojo/data/ObjectStore',
         "dijit/form/Button",
         "dojo/dom-class",
         'dojox/grid/DataGrid',
         'dijit/form/Select',
         'dojox/form/Uploader',
         'dojo/data/ItemFileWriteStore',
         'dojo/_base/xhr',
         'dojox/grid/cells/dijit',
         'dojox/grid/cells',
         'dojo/date',
         'dojo/date/stamp',
         'dojo/date/locale',
         'dojo/currency',
         'dijit/form/DateTextBox',
         'dijit/form/CurrencyTextBox',
         "dojox/grid/_RadioSelector",
         'dojo/ready',
         'dojo/domReady!'],
          function(request,dom,Dialog,locale,array,Memory, ObjectStore,Button,domClass,DataGrid, ItemFileWriteStore, xhr,cells,cellsDijit,date,stamp, locale,currency,localeCurrency, DateTextBox, CurrencyTextBox,ready){


    var dataStore1 =  new ObjectStore({ objectStore:new Memory({ data: <?php  echo json_encode($constructiondrawingsdata) ?> }) });   
    var layout1 = [{

        defaultCell: { width: 8, editable: false, type: cells._Widget, styles: 'text-align: center;'  },
        cells: [

            {name: 'TYPE',         field: 'filepath'    ,formatter: displayIcon ,width:3},
            {name: 'ID',           field: 'id'          ,width:2},
            {name: 'PROJECT',      field: 'project'     ,width:5},
            {name: 'USER',         field: 'user'        ,width:8},
            {name: 'GROUP',        field: 'area'        ,width:5},
            {name: 'DESCRIPTION',  field: 'description' ,width:15},
            {name: 'FILE',         field: 'filepath'    ,formatter: formatlink ,width:20},
            {name: 'SIZE',         field: 'size'        ,width:8},
            {name: 'DATE',         field: 'date'        ,width:8},
            {name: 'STATE',        field: 'status'      ,formatter: formatcolumcolor ,width:18},
            {name: 'REMARKS',      field: 'remarks'     ,width:15}
          ]
    }];

    var grid1 = new DataGrid({
        id: 'grid1',
        query: { id: "*" },
        store: dataStore1,
        structure: layout1,
        loadingMessage: "Loading data...",
        noDataMessage : "No results found",
        clientSort: 'false',
        style: "height:  100%; width: 100%",
        canSort: function(col) { return col != 1; }, 
        selectionMode:'single',
        rowSelector: '0px'});



        grid1.placeAt("gridDiv1");
</script>    




<div data-dojo-type="dijit/layout/BorderContainer" style="padding:0px" data-dojo-props="liveSplitters: true, design: 'headline'">    
  <div id="gridDiv1" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
</div>
</div>    

问题是,当我第一次加载数据网格时,我只从数据库中获得总共9行的7行,然后当我刷新数据网格时,我获得了9行。 此外,如果我在谷歌浏览器中按F12查看控制台并关闭它,我再次丢失数据网格的最后两行(这很奇怪吧?)。 再次,如果我刷新数据网格,我得到9行。

任何人都遇到过这个问题?提前致谢

0 个答案:

没有答案