0

// dojo 网格未完全显示.... // 仅显示页眉和页脚,但不显示内容.... // 我无法发布图像 // 这是代码 */ //请帮助我尽快

<html>
<head>
<link href="DC_OrderReceipts.css" rel="stylesheet" type="text/css" />
    <style type="text/css">@import "../js/dojo/resources/dojo.css";
@import "../js/dijit/themes/claro/claro.css";
@import "../js/dojox/grid/enhanced/resources/claro/EnhancedGrid.css";
@import "../js/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";

/*Grid need a explicit width/height by default*/
#grid {
    width: 76em;
    height: 20em;
}</style>
<script src='../js/dojo/dojo.js'></script>


<script type="text/javascript">
$('a.orderReceiptsHead').click(function(e) {
    e.preventDefault();
    var href = $(this).attr('href');
      $(".tab_container #Dashboard").hide("");
    $(".tab_container #OrderHeader").load(href);
    //$(".orderHead").fadeIn("fast"); 
    //$('.orderHead a:hover').css('text-decoration','none');
});
</script>
<script type="text/javascript">
var prevRow = null;
function toggle(it) {

  if (it.className.substring(0, 3) == "sel")
    {it.className = it.className.substring(3, 6);
     prevRow = null;}
  else
    {it.className = "sel" + it.className;
     if (prevRow != null)
       {prevRow.className = prevRow.className.substring(3, 6);}
     prevRow = it;}
}
</script>
<script>
dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.Pagination");
dojo.require("dojo.data.ItemFileWriteStore");

dojo.ready(function(){
    /*set up data store*/
    var subData = {
      identifier: 'id',
      items: []
    };
    var sub_data_list = [
      { col1: "normal", col2: '20', col3: '98*154-303', col4: '98*154-303', col5: '20-11-2012', col6: '10', col7: '20',col8: '10',col9: 'ST2890GT'},
      { col1: "normal", col2: '20', col3: '98*154-303', col4: '98*154-303', col5: '20-11-2012', col6: '10', col7: '20',col8: '10',col9: 'DHY33OOP'},
      { col1: "normal", col2: '20', col3: '98*154-303', col4: '98*154-303', col5: '20-11-2012', col6: '10', col7: '20',col8: '10',col9: 'ST2880GT'}
    ];
    var rows = 100;
    for(var i=0, l=sub_data_list.length; i<rows; i++){
      subData.items.push(dojo.mixin({ id: i+1 }, sub_data_list[i%l]));
    }
    var subStore = new dojo.data.ItemFileWriteStore({data: subData});

    /*set up layout*/
    var subLayout = [[
      {name: 'Line Number', field: 'id'},
      {name: 'Status', field: 'col2'},
      {name: 'Product Received', field: 'col3',width: "14%"},
      {name: 'Customer Product Received', field: 'col4'},
      {name: 'Date Received', field: 'col5'},
      {name: 'Quantity Expected', field: 'col6'},
      {name: 'Discrepent', field: 'col7'},
      {name: 'Credited', field: 'col8'},
      {name: 'Model Number', field: 'col9'}
    ]];

    /*create a new grid:*/
    var grid2 = new dojox.grid.EnhancedGrid({
        id: 'grid2',    
        query : {}, 
        store: subStore,
        structure: subLayout,
        rowSelector: '20px',
        plugins: {
          pagination: {
              pageSizes: ["25", "50", "100", "All"],
              description: true,
              sizeSwitch: true,
              pageStepper: true,
              gotoButton: true,
                      /*page step to be displayed*/
              maxPageStep: 4,
                      /*position of the pagination bar*/
              position: "bottom"
          }
        }
    }, document.createElement('div'));

    /*append the new grid to the div*/

    dojo.byId("gridDiv").appendChild(grid2.domNode);

    /*Call startup() to render the grid*/
    grid2.startup();
});

</script>
</head>
<body class="claro">

<div id="gridDiv"></div>

</body>        
</html>

// 如果我更改了 id:'grid' 它工作正常![在此处输入图像描述][1]

4

2 回答 2

1

嘿,我得到了解决方案,

错误就在那里,

#grid {
    width: 76em;
    height: 20em;
}

如果我更改 id:'grid2',我忘记在上面的行中更改.....

于 2013-03-08T05:15:53.223 回答
0

尝试这个:

/*create a new grid:*/
var grid2 = new dojox.grid.EnhancedGrid({    
    query : {}, 
    store: subStore,
    structure: subLayout,
    rowSelector: '20px',
    plugins: {
      pagination: {
          pageSizes: ["25", "50", "100", "All"],
          description: true,
          sizeSwitch: true,
          pageStepper: true,
          gotoButton: true,
                  /*page step to be displayed*/
          maxPageStep: 4,
                  /*position of the pagination bar*/
          position: "bottom"
      }
    }
}, "gridDiv"); //give div id here

/*Call startup() to render the grid*/
grid2.startup();
于 2013-03-07T13:26:53.727 回答