// 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]
答案 0 :(得分:1)
该行中存在错误,
#grid {
width: 76em;
height: 20em;
}
如果我改变了id:'grid2',我忘记改变上面的行......
答案 1 :(得分: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();